diff options
author | Andrej Shadura <andrewsh@debian.org> | 2021-01-13 14:00:16 +0100 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2021-01-13 14:00:16 +0100 |
commit | 56044cac92cdd65dc3b4fd03557eaf32976e6da9 (patch) | |
tree | caca2f4e58b83affd235455f61b1bc84bc202816 /synapse/app/_base.py | |
parent | f509bf3ab10e82c5ba6e4e3b5a7db0f9c55026c1 (diff) |
New upstream version 1.25.0
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r-- | synapse/app/_base.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 895b38ae..37ecdbe3 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -245,6 +245,8 @@ def start(hs: "synapse.server.HomeServer", listeners: Iterable[ListenerConfig]): # Set up the SIGHUP machinery. if hasattr(signal, "SIGHUP"): + reactor = hs.get_reactor() + @wrap_as_background_process("sighup") def handle_sighup(*args, **kwargs): # Tell systemd our state, if we're using it. This will silently fail if @@ -260,7 +262,9 @@ def start(hs: "synapse.server.HomeServer", listeners: Iterable[ListenerConfig]): # is so that we're in a sane state, e.g. flushing the logs may fail # if the sighup happens in the middle of writing a log entry. def run_sighup(*args, **kwargs): - hs.get_clock().call_later(0, handle_sighup, *args, **kwargs) + # `callFromThread` should be "signal safe" as well as thread + # safe. + reactor.callFromThread(handle_sighup, *args, **kwargs) signal.signal(signal.SIGHUP, run_sighup) |