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.
This commit is contained in:
Jeong YunWon 2017-06-09 14:46:12 +09:00
parent e1331fc0a2
commit 29b4a2a08c

View File

@ -159,6 +159,7 @@ class GunicornWorker(base.Worker):
def handle_quit(self, sig, frame): def handle_quit(self, sig, frame):
self.alive = False self.alive = False
self.app.callable.is_running = False
self.cfg.worker_int(self) self.cfg.worker_int(self)
def handle_abort(self, sig, frame): def handle_abort(self, sig, frame):