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

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


Revision: 9653
          http://trac.macosforge.org/projects/calendarserver/changeset/9653
Author:   glyph at apple.com
Date:     2012-08-11 01:55:25 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
Hook worker load average up to something.

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:24 UTC (rev 9652)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py	2012-08-11 08:55:25 UTC (rev 9653)
@@ -370,6 +370,7 @@
     def __init__(self, schema, workerPool, boxReceiver=None, locator=None):
         self.workerPool = workerPool
         super(ConnectionFromWorker, self).__init__(schema, boxReceiver, locator)
+        self._load = 0
 
 
     @property
@@ -377,8 +378,7 @@
         """
         What is the current load of this worker?
         """
-        # TODO: this needs to be hooked up to something.
-        return 0
+        return self._load
 
 
     def startReceivingBoxes(self, sender):
@@ -407,8 +407,13 @@
         @see: The responder for this should always be
             L{ConnectionFromController.actuallyReallyExecuteWorkHere}.
         """
-        return self.callRemote(PerformWork,
-                               table=table.model.name, workID=workID)
+        d = self.callRemote(PerformWork, table=table.model.name, workID=workID)
+        self._load += 1
+        @d.addBoth
+        def f(result):
+            self._load -= 1
+            return result
+        return d
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/9d03c9fe/attachment.html>


More information about the calendarserver-changes mailing list