From ec428135ce6251e860da672f7fa9105e2fb89c44 Mon Sep 17 00:00:00 2001 From: Ketan Patel Date: Tue, 7 May 2019 22:38:29 -0700 Subject: [PATCH] 1564 - Moving `processes` variable intialization before `sig_handler`. --- sanic/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic/server.py b/sanic/server.py index 81b68cb5..a2038e3c 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -842,6 +842,8 @@ def serve_multiple(server_settings, workers): server_settings["host"] = None server_settings["port"] = None + processes = [] + def sig_handler(signal, frame): logger.info("Received signal %s. Shutting down.", Signals(signal).name) for process in processes: @@ -850,8 +852,6 @@ def serve_multiple(server_settings, workers): signal_func(SIGINT, lambda s, f: sig_handler(s, f)) signal_func(SIGTERM, lambda s, f: sig_handler(s, f)) - processes = [] - for _ in range(workers): process = Process(target=serve, kwargs=server_settings) process.daemon = True