[CalendarServer-changes] [11484] CalendarServer/branches/users/glyph/hang-fix/twext/web2/metafd.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 5 17:43:24 PDT 2013


Revision: 11484
          http://trac.calendarserver.org//changeset/11484
Author:   glyph at apple.com
Date:     2013-07-05 17:43:24 -0700 (Fri, 05 Jul 2013)
Log Message:
-----------
Refactor to put state-change logic into state-change notification; test still failing.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/hang-fix/twext/web2/metafd.py

Modified: CalendarServer/branches/users/glyph/hang-fix/twext/web2/metafd.py
===================================================================
--- CalendarServer/branches/users/glyph/hang-fix/twext/web2/metafd.py	2013-07-06 00:43:22 UTC (rev 11483)
+++ CalendarServer/branches/users/glyph/hang-fix/twext/web2/metafd.py	2013-07-06 00:43:24 UTC (rev 11484)
@@ -219,14 +219,6 @@
             else:
                 log.error("metafd: trying to zero status that is not None")
                 result = previousStatus
-
-        if message in ('-', '0'):
-            # If load has indeed decreased (i.e. in any case except 'a new,
-            # idle process replaced an old, idle process'), then start
-            # listening again.
-            if result < previousStatus and self.running:
-                for f in self.factories:
-                    f.myServer.myPort.startReading()
         else:
             # '+' is just an acknowledgement of newConnectionStatus, so we can
             # ignore it.
@@ -239,21 +231,28 @@
         Determine the effect of a new connection being sent on a subprocess
         socket.
         """
-        current = self.outstandingRequests + 1
-        maximum = self.maxRequests
-        overloaded = (current >= maximum)
-        if overloaded:
-            for f in self.factories:
-                f.myServer.myPort.stopReading()
-
         result = self.intWithNoneAsZero(previousStatus) + 1
         return result
 
 
     def statusesChanged(self, statuses):
         """
-        FIXME
+        The L{InheritedSocketDispatcher} is reporting that the list of
+        connection-statuses have changed.
+
+        (The argument to this function is currently duplicated by the
+        C{self.dispatcher.statuses} attribute, which is what
+        C{self.outstandingRequests} uses to compute it.)
         """
+        current = self.outstandingRequests + 1
+        maximum = self.maxRequests
+        overloaded = (current >= maximum)
+        if overloaded:
+            for f in self.factories:
+                f.myServer.myPort.stopReading()
+        else:
+            for f in self.factories:
+                f.myServer.myPort.startReading()
 
 
     def intWithNoneAsZero(self, x):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130705/3c2544a4/attachment.html>


More information about the calendarserver-changes mailing list