Merge pull request #847 from youknowone/gunicorn
ensure loop.close() and sys.exit() in gunicorn worker
This commit is contained in:
commit
48549ce97b
|
@ -3,6 +3,7 @@ import sys
|
||||||
import signal
|
import signal
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
|
@ -69,10 +70,16 @@ class GunicornWorker(base.Worker):
|
||||||
trigger_events(self._server_settings.get('before_stop', []),
|
trigger_events(self._server_settings.get('before_stop', []),
|
||||||
self.loop)
|
self.loop)
|
||||||
self.loop.run_until_complete(self.close())
|
self.loop.run_until_complete(self.close())
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
finally:
|
finally:
|
||||||
trigger_events(self._server_settings.get('after_stop', []),
|
try:
|
||||||
self.loop)
|
trigger_events(self._server_settings.get('after_stop', []),
|
||||||
self.loop.close()
|
self.loop)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
finally:
|
||||||
|
self.loop.close()
|
||||||
|
|
||||||
sys.exit(self.exit_code)
|
sys.exit(self.exit_code)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user