[CalendarServer-changes] [11251] CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/ delivery.py

source_changes at macosforge.org source_changes at macosforge.org
Tue May 28 13:22:31 PDT 2013


Revision: 11251
          http://trac.calendarserver.org//changeset/11251
Author:   sagen at apple.com
Date:     2013-05-28 13:22:31 -0700 (Tue, 28 May 2013)
Log Message:
-----------
Use inTransaction( ) to automatically commit/abort the enqueue of imip work

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py	2013-05-28 17:06:28 UTC (rev 11250)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py	2013-05-28 20:22:31 UTC (rev 11251)
@@ -19,6 +19,7 @@
 Handles the sending of scheduling messages via iMIP (mail gateway).
 """
 
+from twext.enterprise.queue import inTransaction
 from twext.python.log import Logger
 from twext.web2 import responsecode
 from twext.web2.dav.http import ErrorResponse
@@ -99,10 +100,20 @@
 
                     fromAddr = str(self.scheduler.originator.cuaddr)
 
-                    txn = yield self.scheduler.txn.store().newTransaction("Submitting iMIP message for UID: %s" % (self.scheduler.calendar.resourceUID(),))
+
                     log.debug("Submitting iMIP message...  To: '%s', From :'%s'\n%s" % (toAddr, fromAddr, caldata,))
-                    yield txn.enqueue(IMIPInvitationWork, fromAddr=fromAddr, toAddr=toAddr, icalendarText=caldata)
 
+                    def enqueueOp(txn):
+                        return txn.enqueue(IMIPInvitationWork, fromAddr=fromAddr,
+                            toAddr=toAddr, icalendarText=caldata)
+
+                    yield inTransaction(
+                        lambda: self.scheduler.txn.store().newTransaction(
+                            "Submitting iMIP message for UID: %s" % (
+                            self.scheduler.calendar.resourceUID(),)),
+                        enqueueOp
+                    )
+
                 except Exception, e:
                     # Generated failed response for this recipient
                     log.debug("iMIP request %s failed for recipient %s: %s" % (self, recipient, e))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130528/3d02c2d5/attachment.html>


More information about the calendarserver-changes mailing list