Add the killing of children

Kills children processes when parent process receives a signal to
shutdown.

Solves for #594
This commit is contained in:
Eli Uriegas 2017-04-27 17:47:08 -07:00
parent ed0081fcf7
commit 436d37c079

View File

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