Proper shutdown at sigterm
This commit is contained in:
parent
b8b8ce21fa
commit
74ce0c50ff
1 changed files with 6 additions and 0 deletions
|
@ -81,6 +81,12 @@ def handleGreenletError(self, context, type, value, tb):
|
|||
|
||||
gevent.hub.Hub.handle_error = handleGreenletError
|
||||
|
||||
try:
|
||||
signal.signal(signal.SIGTERM, lambda signum, stack_frame: shutdown("SIGTERM"))
|
||||
except Exception as err:
|
||||
logging.debug("Error setting up SIGTERM watcher: %s" % err)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import time
|
||||
from gevent import monkey
|
||||
|
|
Loading…
Reference in a new issue