[CalendarServer-changes] [9687] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:55:54 PDT 2012


Revision: 9687
          http://trac.macosforge.org/projects/calendarserver/changeset/9687
Author:   glyph at apple.com
Date:     2012-08-11 01:55:54 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
improved node-index calculation

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py	2012-08-11 08:55:54 UTC (rev 9686)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py	2012-08-11 08:55:54 UTC (rev 9687)
@@ -162,7 +162,6 @@
 
 
 
-
 class TableSyntaxByName(Argument):
     """
     Serialize and deserialize L{TableSyntax} objects for an AMP protocol with
@@ -1023,6 +1022,13 @@
         """
         @inlineCallbacks
         def workCheck(txn):
+
+            nodes = [(node.hostname, node.port) for node in
+                     (yield self.activeNodes(txn))]
+            nodes.sort()
+            self._lastSeenTotalNodes = len(nodes)
+            self._lastSeenNodeIndex = nodes.index((self.thisProcess.hostname,
+                                                   self.thisProcess.port))
             for itemType in self.allWorkItemTypes():
                 for overdueItem in (
                         yield itemType.query(
@@ -1052,6 +1058,7 @@
                 return
             index = self.nodeIndex()
             now = self.reactor.seconds()
+
             interval = self.queueDelayedProcessInterval
             count = self.totalNumberOfNodes()
             when = (now - (now % interval)) + (interval * (count + index))
@@ -1090,8 +1097,10 @@
                     txn, hostname=self.hostname, port=self.ampPort,
                     pid=self.pid, time=datetime.now()
                 )
+                nodes.append(self.thisProcess)
             for node in nodes:
                 self._startConnectingTo(node)
+
         self._startingUp = inTransaction(self.transactionFactory, startup)
         @self._startingUp.addBoth
         def done(result):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/92293d29/attachment-0001.html>


More information about the calendarserver-changes mailing list