[CalendarServer-changes] [15773] twext/branches/users/vramachandran/disableWorkProcessing/twext/ enterprise/jobs/queue.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 15 10:41:00 PDT 2016


Revision: 15773
          http://trac.calendarserver.org//changeset/15773
Author:   vramachandran at apple.com
Date:     2016-07-15 10:41:00 -0700 (Fri, 15 Jul 2016)
Log Message:
-----------
Added code to stop DB polling if the new flag disableWorkProcessing is set.

Modified Paths:
--------------
    twext/branches/users/vramachandran/disableWorkProcessing/twext/enterprise/jobs/queue.py

Modified: twext/branches/users/vramachandran/disableWorkProcessing/twext/enterprise/jobs/queue.py
===================================================================
--- twext/branches/users/vramachandran/disableWorkProcessing/twext/enterprise/jobs/queue.py	2016-07-15 16:48:20 UTC (rev 15772)
+++ twext/branches/users/vramachandran/disableWorkProcessing/twext/enterprise/jobs/queue.py	2016-07-15 17:41:00 UTC (rev 15773)
@@ -469,7 +469,7 @@
     # server always use 1.
     rowLimit = 1
 
-    def __init__(self, reactor, transactionFactory, useWorkerPool=True, disableWorkProcessing=False):
+    def __init__(self, reactor, transactionFactory, useWorkerPool=True, migrationOnly=False, disableWorkProcessing=False):
         """
         Initialize a L{ControllerQueue}.
 
@@ -483,6 +483,7 @@
         self.reactor = reactor
         self.transactionFactory = transactionFactory
         self.workerPool = WorkerConnectionPool() if useWorkerPool else None
+        self.migrationOnly = migrationOnly
         self.disableWorkProcessing = disableWorkProcessing
         self._lastMinPriority = WORK_PRIORITY_LOW
         self._timeOfLastWork = time.time()
@@ -495,14 +496,14 @@
         """
         Turn on work queue processing.
         """
-        self.disableWorkProcessing = False
+        self.migrationOnly = False
 
 
     def disable(self):
         """
         Turn off work queue processing.
         """
-        self.disableWorkProcessing = True
+        self.migrationOnly = True
 
 
     def totalLoad(self):
@@ -545,7 +546,7 @@
 
         loopCounter = 0
         while True:
-            if not self.running or self.disableWorkProcessing:
+            if not self.running or self.migrationOnly:
                 returnValue(None)
 
             # Check the overall service load - if overloaded skip this poll cycle.
@@ -663,7 +664,7 @@
         """
         self._workCheckCall = None
 
-        if not self.running:
+        if not self.running or self.disableWorkProcessing:
             returnValue(None)
 
         try:
@@ -671,7 +672,7 @@
         except Exception as e:
             log.error("_workCheckLoop: {exc}", exc=e)
 
-        if not self.running:
+        if not self.running or self.disableWorkProcessing:
             returnValue(None)
 
         # Check for adjustment to poll interval - if the workCheck is idle for certain
@@ -700,7 +701,7 @@
 
         loopCounter = 0
         while True:
-            if not self.running or self.disableWorkProcessing:
+            if not self.running or self.migrationOnly:
                 returnValue(None)
 
             # Determine what the timestamp cutoff
@@ -797,7 +798,7 @@
         """
         self._overdueCheckCall = None
 
-        if not self.running:
+        if not self.running or self.disableWorkProcessing:
             returnValue(None)
 
         try:
@@ -805,7 +806,7 @@
         except Exception as e:
             log.error("_overdueCheckLoop: {exc}", exc=e)
 
-        if not self.running:
+        if not self.running or self.disableWorkProcessing:
             returnValue(None)
 
         self._overdueCheckCall = self.reactor.callLater(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160715/ac6927f0/attachment-0001.html>


More information about the calendarserver-changes mailing list