Merge pull request #1565 from ketan86/1564-processes-initialization-fix
1564 - Moving `processes` variable intialization before `sig_handler`.
This commit is contained in:
commit
f70ab2f68a
|
@ -842,6 +842,8 @@ def serve_multiple(server_settings, workers):
|
||||||
server_settings["host"] = None
|
server_settings["host"] = None
|
||||||
server_settings["port"] = None
|
server_settings["port"] = None
|
||||||
|
|
||||||
|
processes = []
|
||||||
|
|
||||||
def sig_handler(signal, frame):
|
def sig_handler(signal, frame):
|
||||||
logger.info("Received signal %s. Shutting down.", Signals(signal).name)
|
logger.info("Received signal %s. Shutting down.", Signals(signal).name)
|
||||||
for process in processes:
|
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(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))
|
||||||
|
|
||||||
processes = []
|
|
||||||
|
|
||||||
for _ in range(workers):
|
for _ in range(workers):
|
||||||
process = Process(target=serve, kwargs=server_settings)
|
process = Process(target=serve, kwargs=server_settings)
|
||||||
process.daemon = True
|
process.daemon = True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user