Trigger before_stop before closing server, after_stop before closing

loop
This commit is contained in:
messense 2017-03-14 23:56:52 +08:00
parent decd3e737c
commit 7ca9116e37
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9

View File

@ -44,13 +44,13 @@ class GunicornWorker(base.Worker):
self.loop)
self.loop.run_until_complete(self._check_alive())
finally:
trigger_events(self._server_settings.get('before_stop', []),
self.loop)
self.loop.close()
trigger_events(self._server_settings.get('after_stop', []),
self.loop)
self.loop.close()
async def close(self):
trigger_events(self._server_settings.get('before_stop', []),
self.loop)
if self.servers:
# stop accepting connections
self.log.info("Stopping server: %s, connections: %s",