Merge "Fix regression in WSGI server SIGHUP behavior"

This commit is contained in:
Jenkins 2015-07-31 23:50:04 +00:00 committed by Gerrit Code Review
commit a5af24dd92
2 changed files with 10 additions and 5 deletions

View File

@ -461,10 +461,14 @@ class WorkersStrategy(object):
def loop_timeout(self):
"""
:returns: None; to block in :py:func:`green.os.wait`
We want to keep from busy-waiting, but we also need a non-None value so
the main loop gets a chance to tell whether it should keep running or
not (e.g. SIGHUP received).
So we return 0.5.
"""
return None
return 0.5
def bind_ports(self):
"""

View File

@ -1090,9 +1090,10 @@ class TestWorkersStrategy(unittest.TestCase):
self.addCleanup(patcher.stop)
def test_loop_timeout(self):
# This strategy should block in the green.os.wait() until a worker
# process exits.
self.assertEqual(None, self.strategy.loop_timeout())
# This strategy should sit in the green.os.wait() for a bit (to avoid
# busy-waiting) but not forever (so the keep-running flag actually
# gets checked).
self.assertEqual(0.5, self.strategy.loop_timeout())
def test_binding(self):
self.assertEqual(None, self.strategy.bind_ports())