[CalendarServer-changes] [11301] CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/ enterprise/test/test_queue.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 5 11:42:10 PDT 2013


Revision: 11301
          http://trac.calendarserver.org//changeset/11301
Author:   glyph at apple.com
Date:     2013-06-05 11:42:10 -0700 (Wed, 05 Jun 2013)
Log Message:
-----------
Let's use a real concurrent transaction; faking it has too many weird side effects.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py

Modified: CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py
===================================================================
--- CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py	2013-06-05 18:42:09 UTC (rev 11300)
+++ CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/test/test_queue.py	2013-06-05 18:42:10 UTC (rev 11301)
@@ -198,16 +198,18 @@
 
     @classmethod
     @inlineCallbacks
-    def load(cls, *a, **kw):
+    def load(cls, txn, *a, **kw):
         """
         Load L{DummyWorkItem} as normal...  unless the loaded item has
-        C{DELETE_ON_LOAD} set, in which case, simulate a concurrent transaction
-        doing a delete/commit immediately after load (by just doing it in the
-        same transaction).
+        C{DELETE_ON_LOAD} set, in which case, do a deletion of this same row in
+        a concurrent transaction, then commit it.
         """
-        self = yield super(DummyWorkItem, cls).load(*a, **kw)
+        self = yield super(DummyWorkItem, cls).load(txn, *a, **kw)
         if self.deleteOnLoad:
-            yield self.delete()
+            otherTransaction = txn.concurrently()
+            otherSelf = yield super(DummyWorkItem, cls).load(txn, *a, **kw)
+            yield otherSelf.delete()
+            yield otherTransaction.commit()
         returnValue(self)
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130605/4a0f90b4/attachment-0001.html>


More information about the calendarserver-changes mailing list