diff options
author | drebs <drebs@riseup.net> | 2017-11-21 20:25:21 -0200 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-11-22 08:23:59 -0200 |
commit | 00a201d0f3fb4796286300fe7b16eda189afef7a (patch) | |
tree | c2a713498b550b03a248df81ad152f8050a469cf /src/leap/soledad/server | |
parent | 787f5360b801eecbebb4d28128c343832b29df57 (diff) |
[bug] ensure shutdown happens only after reactor start
Diffstat (limited to 'src/leap/soledad/server')
-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): |