send SIGQUIT/SIGTERM only once to the workers

there is no need to send more than once the signal to the workers when
exiting. With this patch we are sending once the QUIT/TERM signal and  then
wait until the graceful timeout or until there are workers alive.

fix #655
This commit is contained in:
benoitc 2014-12-19 08:01:18 +01:00
parent e63df69229
commit d1a0973225

View File

@ -348,9 +348,12 @@ class Arbiter(object):
if not graceful:
sig = signal.SIGQUIT
limit = time.time() + self.cfg.graceful_timeout
# instruct the workers to exit
self.kill_workers(sig)
# wait until the graceful timeout
while self.WORKERS and time.time() < limit:
self.kill_workers(sig)
time.sleep(0.1)
self.kill_workers(signal.SIGKILL)
def reexec(self):