Skip to content

Commit

Permalink
send SIGQUIT/SIGTERM only once to the workers
Browse files Browse the repository at this point in the history
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
  • Loading branch information
benoitc committed Dec 19, 2014
1 parent e63df69 commit d1a0973
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gunicorn/arbiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,12 @@ def stop(self, graceful=True):
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):
Expand Down

0 comments on commit d1a0973

Please sign in to comment.