Merge pull request #668 from seemethere/stop_workers_on_sigint

Add the killing of children
This commit is contained in:
Raphael Deem 2017-04-27 22:39:48 -07:00 committed by GitHub
commit 656f5b93d6

View File

@ -502,6 +502,8 @@ def serve_multiple(server_settings, workers):
def sig_handler(signal, frame): def sig_handler(signal, frame):
log.info("Received signal {}. Shutting down.".format( log.info("Received signal {}. Shutting down.".format(
Signals(signal).name)) Signals(signal).name))
for process in processes:
os.kill(process.pid, SIGINT)
signal_func(SIGINT, lambda s, f: sig_handler(s, f)) signal_func(SIGINT, lambda s, f: sig_handler(s, f))
signal_func(SIGTERM, lambda s, f: sig_handler(s, f)) signal_func(SIGTERM, lambda s, f: sig_handler(s, f))