[CalendarServer-changes] [12737] CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:23:14 PDT 2014
Revision: 12737
http://trac.calendarserver.org//changeset/12737
Author: gaya at apple.com
Date: 2014-02-20 13:38:17 -0800 (Thu, 20 Feb 2014)
Log Message:
-----------
In InboxCleanupWork.doWork(), use Count() instead of Select() to find the number of rows in CLEANUP_ONE_INBOX_WORK table.
Modified Paths:
--------------
CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py
Modified: CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py 2014-02-20 20:28:50 UTC (rev 12736)
+++ CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py 2014-02-20 21:38:17 UTC (rev 12737)
@@ -20,7 +20,7 @@
"""
from twext.enterprise.dal.record import fromTable
-from twext.enterprise.dal.syntax import Delete, Select
+from twext.enterprise.dal.syntax import Delete, Select, Count
from twext.enterprise.queue import WorkItem
from twext.python.log import Logger
from twisted.internet.defer import inlineCallbacks, returnValue
@@ -53,11 +53,14 @@
# exit if not done with last delete:
coiw = schema.CLEANUP_ONE_INBOX_WORK
- rows = yield Select([coiw.HOME_ID], From=coiw,).on(self.transaction)
- if rows:
- homeIDs = [row[0] for row in rows]
- log.error("Inbox cleanup work: Can't schedule per-home cleanup because work items still queued for homeIDs: {}".format(
- homeIDs))
+ queuedCleanupOneInboxWorkItems = (yield Select(
+ [Count(coiw.HOME_ID)],
+ From=coiw,
+ ).on(self.transaction))[0][0]
+
+ if queuedCleanupOneInboxWorkItems:
+ log.error("Inbox cleanup work: Can't schedule per home cleanup because {} work items still queued.".format(
+ queuedCleanupOneInboxWorkItems))
else:
# enumerate provisioned normal calendar homes
ch = schema.CALENDAR_HOME
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/2f677de4/attachment.html>
More information about the calendarserver-changes
mailing list