# HG changeset patch # User Allan Saddi # Date 1250538163 25200 # Node ID 6ea1ffac1bcb8753a0909d598bddf3486f45dbdc # Parent e0e7e885f6cc57731cc456caec1f294405f2e006 Restore check of the absolute number of children against maxSpare and document rationale. diff -r e0e7e885f6cc -r 6ea1ffac1bcb flup/server/preforkserver.py --- a/flup/server/preforkserver.py Mon Aug 17 13:46:42 2009 -0500 +++ b/flup/server/preforkserver.py Mon Aug 17 12:42:43 2009 -0700 @@ -126,8 +126,12 @@ # Main loop. while self._keepGoing: - # Maintain minimum number of children. - while len(self._children) < self._minSpare: + # Maintain minimum number of children. Note that we are checking + # the absolute number of children, not the number of "available" + # children. We explicitly test against _maxSpare to maintain + # an *optimistic* absolute minimum. The number of children will + # always be in the range [_maxSpare, _maxChildren]. + while len(self._children) < self._maxSpare: if not self._spawnChild(sock): break # Wait on any socket activity from live children.