Skip to content

Commit

Permalink
Proper shutdown at sigterm
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Mar 23, 2019
1 parent b8b8ce2 commit 74ce0c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Debug/DebugHook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 74ce0c5

Please sign in to comment.