[CalendarServer-changes] [13238] CalendarServer/trunk/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Apr 9 19:15:19 PDT 2014
Revision: 13238
http://trac.calendarserver.org//changeset/13238
Author: sagen at apple.com
Date: 2014-04-09 19:15:19 -0700 (Wed, 09 Apr 2014)
Log Message:
-----------
groups uses store.inTransaction; pass label to transaction creator
Modified Paths:
--------------
CalendarServer/trunk/txdav/common/datastore/file.py
CalendarServer/trunk/txdav/common/datastore/sql.py
CalendarServer/trunk/txdav/common/datastore/test/test_sql.py
CalendarServer/trunk/txdav/who/groups.py
Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py 2014-04-10 02:00:00 UTC (rev 13237)
+++ CalendarServer/trunk/txdav/common/datastore/file.py 2014-04-10 02:15:19 UTC (rev 13238)
@@ -202,10 +202,10 @@
"""
if transactionCreator is None:
- txn = self.newTransaction()
- else:
- txn = transactionCreator(label=label)
+ transactionCreator = self.newTransaction
+ txn = transactionCreator(label=label)
+
try:
result = yield operation(txn)
except:
Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py 2014-04-10 02:00:00 UTC (rev 13237)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py 2014-04-10 02:15:19 UTC (rev 13238)
@@ -313,10 +313,10 @@
"""
if transactionCreator is None:
- txn = self.newTransaction()
- else:
- txn = transactionCreator(label=label)
+ transactionCreator = self.newTransaction
+ txn = transactionCreator(label=label)
+
try:
result = yield operation(txn)
except:
Modified: CalendarServer/trunk/txdav/common/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/test_sql.py 2014-04-10 02:00:00 UTC (rev 13237)
+++ CalendarServer/trunk/txdav/common/datastore/test/test_sql.py 2014-04-10 02:15:19 UTC (rev 13238)
@@ -457,12 +457,14 @@
yield store.inTransaction("good", goodOperation, txnCreator)
self.assertEquals(self.txn.action, "committed")
+ self.assertEquals(self.txn.label, "good")
try:
yield store.inTransaction("bad", badOperation, txnCreator)
except:
pass
self.assertEquals(self.txn.action, "aborted")
+ self.assertEquals(self.txn.label, "bad")
Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py 2014-04-10 02:00:00 UTC (rev 13237)
+++ CalendarServer/trunk/txdav/who/groups.py 2014-04-10 02:15:19 UTC (rev 13238)
@@ -87,15 +87,20 @@
@inlineCallbacks
def scheduleNextGroupCachingUpdate(store, seconds):
- txn = store.newTransaction(label="scheduleNextGroupCachingUpdate")
+
notBefore = (
datetime.datetime.utcnow() + datetime.timedelta(seconds=seconds)
)
+
log.debug(
"Scheduling next group cacher update: {when}", when=notBefore
)
- wp = (yield txn.enqueue(GroupCacherPollingWork, notBefore=notBefore))
- yield txn.commit()
+
+ def _enqueue(txn):
+ return txn.enqueue(GroupCacherPollingWork, notBefore=notBefore)
+
+ wp = yield store.inTransaction("scheduleNextGroupCachingUpdate", _enqueue)
+
returnValue(wp)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140409/76914904/attachment.html>
More information about the calendarserver-changes
mailing list