diff options
-rw-r--r-- | src/leap/soledad/server/app.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/leap/soledad/server/app.py b/src/leap/soledad/server/app.py index cad4f31b..2004de1e 100644 --- a/src/leap/soledad/server/app.py +++ b/src/leap/soledad/server/app.py @@ -32,13 +32,14 @@ from leap.soledad.server import get_config logger = getLogger(__name__) +def _deferred_shutdown(status): + reactor.addSystemEventTrigger('after', 'shutdown', + os._exit, status) + reactor.stop() + + def _exit(status): - if reactor.running: - reactor.addSystemEventTrigger( - 'after', 'shutdown', os._exit, status) - reactor.stop() - else: - os._exit(status) + reactor.callWhenRunning(_deferred_shutdown, status) def _log_and_exit(failure): |