[CalendarServer-changes] [6356] CalendarServer/branches/users/glyph/more-deferreds-6/txdav

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 23 13:12:20 PDT 2010


Revision: 6356
          http://trac.macosforge.org/projects/calendarserver/changeset/6356
Author:   glyph at apple.com
Date:     2010-09-23 13:12:19 -0700 (Thu, 23 Sep 2010)
Log Message:
-----------
hopefully the last few commit() stragglers

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_sql.py
    CalendarServer/branches/users/glyph/more-deferreds-6/txdav/common/datastore/util.py

Modified: CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_sql.py	2010-09-23 19:20:38 UTC (rev 6355)
+++ CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_sql.py	2010-09-23 20:12:19 UTC (rev 6356)
@@ -45,8 +45,9 @@
     def setUp(self):
         super(AddressBookSQLStorageTests, self).setUp()
         self._sqlStore = yield buildStore(self, self.notifierFactory)
-        self.populate()
+        yield self.populate()
 
+    @inlineCallbacks
     def populate(self):
         populateTxn = self.storeUnderTest().newTransaction()
         for homeUID in self.requirements:
@@ -67,7 +68,7 @@
                                 objectName, VCard.fromString(objData)
                             )
 
-        populateTxn.commit()
+        yield populateTxn.commit()
         self.notifierFactory.reset()
 
 
@@ -203,19 +204,19 @@
         # existing data in the table
         home_uid2 = txn3.homeWithUID(EADDRESSBOOKTYPE, "uid2", create=True)
         self.assertNotEqual(home_uid2, None)
-        txn3.commit()
+        yield txn3.commit()
 
         home_uid1_1 = txn1.homeWithUID(EADDRESSBOOKTYPE, "uid1", create=True)
 
         def _defer_home_uid1_2():
             home_uid1_2 = txn2.homeWithUID(EADDRESSBOOKTYPE, "uid1", create=True)
-            txn2.commit()
+            txn2.commit() # FIXME: CONCURRENT
             return home_uid1_2
         d1 = deferToThread(_defer_home_uid1_2)
 
         def _pause_home_uid1_1():
             time.sleep(1)
-            txn1.commit()
+            txn1.commit() # FIXME: CONCURRENT
         d2 = deferToThread(_pause_home_uid1_1)
 
         # Verify that we can still get to the existing home - i.e. the lock
@@ -223,7 +224,7 @@
         txn4 = addressbookStore3.newTransaction()
         home_uid2 = txn4.homeWithUID(EADDRESSBOOKTYPE, "uid2", create=True)
         self.assertNotEqual(home_uid2, None)
-        txn4.commit()
+        yield txn4.commit()
 
         # Now do the concurrent provision attempt
         yield d2
@@ -247,7 +248,7 @@
         txn = addressbookStore1.newTransaction()
         home = txn.homeWithUID(EADDRESSBOOKTYPE, "uid1", create=True)
         self.assertNotEqual(home, None)
-        txn.commit()
+        yield txn.commit()
 
         txn1 = addressbookStore1.newTransaction()
         txn2 = addressbookStore2.newTransaction()
@@ -257,7 +258,7 @@
         
         adbk1 = home1.addressbookWithName("addressbook")
         adbk2 = home2.addressbookWithName("addressbook")
-        
+
         def _defer1():
             adbk1.createObjectResourceWithName("1.vcf", VCard.fromString(
                 """BEGIN:VCARD
@@ -273,7 +274,7 @@
 END:VCARD
 """.replace("\n", "\r\n")
             ))
-            txn1.commit()
+            txn1.commit() # FIXME: CONCURRENT
         d1 = deferToThread(_defer1)
             
         def _defer2():
@@ -291,7 +292,7 @@
 END:VCARD
 """.replace("\n", "\r\n")
             ))
-            txn2.commit()
+            txn2.commit() # FIXME: CONCURRENT
         d2 = deferToThread(_defer2)
 
         yield d1

Modified: CalendarServer/branches/users/glyph/more-deferreds-6/txdav/common/datastore/util.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-6/txdav/common/datastore/util.py	2010-09-23 19:20:38 UTC (rev 6355)
+++ CalendarServer/branches/users/glyph/more-deferreds-6/txdav/common/datastore/util.py	2010-09-23 20:12:19 UTC (rev 6356)
@@ -104,13 +104,13 @@
                     self.log_warn(
                         "%s home %r already existed not migrating" % (
                             homeType, uid))
-                    sqlTxn.abort()
-                    fileTxn.commit()
+                    yield sqlTxn.abort()
+                    yield fileTxn.commit()
                     continue
                 sqlHome = homeGetter(uid, create=True)
                 yield migrateFunc(fileHome, sqlHome)
-                fileTxn.commit()
-                sqlTxn.commit()
+                yield fileTxn.commit()
+                yield sqlTxn.commit()
                 # FIXME: need a public remove...HomeWithUID() for de-
                 # provisioning
                 storePath = self.fileStore._path
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100923/da68f04b/attachment.html>


More information about the calendarserver-changes mailing list