Revision: 225
http://svn.sourceforge.net/nmailserver/?rev=225&view=rev
Author: tmyroadctfig
Date: 2007-06-16 08:00:42 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Changed get next delivery attempt to use a transaction.
Modified Paths:
--------------
NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs
Modified: NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs
===================================================================
--- NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs 2007-06-16 14:59:46 UTC (rev 224)
+++ NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs 2007-06-16 15:00:42 UTC (rev 225)
@@ -276,16 +276,20 @@
log.Debug("Checking the next scheduled delivery attempt.");
using (ISession session = this.hibernateFactory.OpenSession()) {
- // Get a lists of hosts with deliveries in progress
- IQuery query = session.CreateQuery("select mr1 from NMail.DataTypes.SmtpMessageRecipient as mr1 where mr1.InProgress = false and mr1.Message.Filtered = true and mr1.Host not in (select mr2.Host From NMail.DataTypes.SmtpMessageRecipient as mr2 where mr2.InProgress = true) order by mr1.NextDeliveryAttempt asc");
- IList<SmtpMessageRecipient> recipients = query.List<SmtpMessageRecipient>();
+ using (ITransaction tx = session.BeginTransaction()) {
+ // Get a lists of hosts with deliveries in progress
+ IQuery query = session.CreateQuery("select mr1 from NMail.DataTypes.SmtpMessageRecipient as mr1 where mr1.InProgress = false and mr1.Message.Filtered = true and mr1.Host not in (select mr2.Host From NMail.DataTypes.SmtpMessageRecipient as mr2 where mr2.InProgress = true) order by mr1.NextDeliveryAttempt asc");
+ IList<SmtpMessageRecipient> recipients = query.List<SmtpMessageRecipient>();
- if (recipients.Count > 0) {
- return recipients[0].NextDeliveryAttempt;
+ if (recipients.Count > 0) {
+ tx.Commit();
+ return recipients[0].NextDeliveryAttempt;
+ }
+
+ // No match
+ tx.Commit();
+ return DateTime.MaxValue;
}
-
- // No match
- return DateTime.MaxValue;
}
}
#endregion
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|