From 2352412213076b52f124ff5137a178aad4c17225 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 9 Jun 2017 14:46:12 +0900 Subject: [PATCH] Gunicorn worker hints app weather it is being terminated For now, `Sanic.is_running` is set when the worker is started but not unset when it is about to stopped. Setting the flag for quit signal will not affect working requests, but the `Sanic.is_running` flag still can be used to support graceful termination. --- sanic/worker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sanic/worker.py b/sanic/worker.py index d15fda41..1d3e384b 100644 --- a/sanic/worker.py +++ b/sanic/worker.py @@ -159,6 +159,7 @@ class GunicornWorker(base.Worker): def handle_quit(self, sig, frame): self.alive = False + self.app.callable.is_running = False self.cfg.worker_int(self) def handle_abort(self, sig, frame):