[CalendarServer-changes] [10929] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 15 05:28:14 PDT 2013


Revision: 10929
          http://trac.calendarserver.org//changeset/10929
Author:   glyph at apple.com
Date:     2013-03-15 05:28:14 -0700 (Fri, 15 Mar 2013)
Log Message:
-----------
Detect when tables aren't present in the schema, and don't try to query them.

Modified Paths:
--------------
    CalendarServer/trunk/twext/enterprise/queue.py
    CalendarServer/trunk/twext/enterprise/test/test_queue.py

Property Changed:
----------------
    CalendarServer/trunk/

Modified: CalendarServer/trunk/twext/enterprise/queue.py
===================================================================
--- CalendarServer/trunk/twext/enterprise/queue.py	2013-03-15 05:15:14 UTC (rev 10928)
+++ CalendarServer/trunk/twext/enterprise/queue.py	2013-03-15 12:28:14 UTC (rev 10929)
@@ -1197,8 +1197,6 @@
         return self.choosePerformer(onlyLocally=True).performWork(table, workID)
 
 
-
-
     def allWorkItemTypes(self):
         """
         Load all the L{WorkItem} types that this node can process and return
@@ -1208,7 +1206,14 @@
         """
         # TODO: For completeness, this may need to involve a plugin query to
         # make sure that all WorkItem subclasses are imported first.
-        return WorkItem.__subclasses__()
+        for workItemSubclass in WorkItem.__subclasses__():
+            # TODO: It might be a good idea to offload this table-filtering to
+            # SchemaSyntax.__contains__, adding in some more structure-
+            # comparison of similarly-named tables.  For now a name check is
+            # sufficient.
+            if workItemSubclass.table.model.name in set([x.model.name for x in
+                                                         self.schema]):
+                yield workItemSubclass
 
 
     def totalNumberOfNodes(self):

Modified: CalendarServer/trunk/twext/enterprise/test/test_queue.py
===================================================================
--- CalendarServer/trunk/twext/enterprise/test/test_queue.py	2013-03-15 05:15:14 UTC (rev 10928)
+++ CalendarServer/trunk/twext/enterprise/test/test_queue.py	2013-03-15 12:28:14 UTC (rev 10929)
@@ -337,7 +337,7 @@
 
 
     @inlineCallbacks
-    def FIXME_test_notBeforeWhenCheckingForLostWork(self):
+    def test_notBeforeWhenCheckingForLostWork(self):
         """
         L{PeerConnectionPool._periodicLostWorkCheck} should execute any
         outstanding work items, but only those that are expired.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130315/bae8ebf4/attachment.html>


More information about the calendarserver-changes mailing list