ensure loop.close() and sys.exit() in gunicorn worker
This commit is contained in:
parent
b755431b93
commit
be0f3731b4
|
@ -3,6 +3,7 @@ import sys
|
|||
import signal
|
||||
import asyncio
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import ssl
|
||||
|
@ -69,9 +70,15 @@ class GunicornWorker(base.Worker):
|
|||
trigger_events(self._server_settings.get('before_stop', []),
|
||||
self.loop)
|
||||
self.loop.run_until_complete(self.close())
|
||||
except:
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
try:
|
||||
trigger_events(self._server_settings.get('after_stop', []),
|
||||
self.loop)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
self.loop.close()
|
||||
|
||||
sys.exit(self.exit_code)
|
||||
|
|
Loading…
Reference in New Issue
Block a user