mirror of
https://github.com/markqvist/LXMF.git
synced 2026-04-27 14:20:39 +00:00
Ensure LXMF and RNS exit handlers are called on SIGINT and SIGTERM, since for some ungodly reason atexit events are not always called on some combinations of Python version and platforms, even though they have been registered.
This commit is contained in:
parent
62038573f1
commit
dca6cc2adc
1 changed files with 4 additions and 2 deletions
|
|
@ -1360,14 +1360,16 @@ class LXMRouter:
|
|||
def sigint_handler(self, signal, frame):
|
||||
if not self.exit_handler_running:
|
||||
RNS.log("Received SIGINT, shutting down now!", RNS.LOG_WARNING)
|
||||
sys.exit(0)
|
||||
self.exit_handler()
|
||||
RNS.exit(0)
|
||||
else:
|
||||
RNS.log("Received SIGINT, but exit handler is running, keeping process alive until storage persist is complete", RNS.LOG_WARNING)
|
||||
|
||||
def sigterm_handler(self, signal, frame):
|
||||
if not self.exit_handler_running:
|
||||
RNS.log("Received SIGTERM, shutting down now!", RNS.LOG_WARNING)
|
||||
sys.exit(0)
|
||||
self.exit_handler()
|
||||
RNS.exit(0)
|
||||
else:
|
||||
RNS.log("Received SIGTERM, but exit handler is running, keeping process alive until storage persist is complete", RNS.LOG_WARNING)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue