Skip to content
Snippets Groups Projects
Unverified Commit 0b794cbd authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Fix sdnotify with acme enabled (#6571)

If acme was enabled, the sdnotify startup hook would never be run because we
would try to add it to a hook which had already fired.

There's no need to delay it: we can sdnotify as soon as we've started the
listeners.
parent b95b7625
No related branches found
No related tags found
No related merge requests found
Fix a bug which meant that we did not send systemd notifications on startup if acme was enabled.
...@@ -237,6 +237,12 @@ def start(hs, listeners=None): ...@@ -237,6 +237,12 @@ def start(hs, listeners=None):
""" """
Start a Synapse server or worker. Start a Synapse server or worker.
Should be called once the reactor is running and (if we're using ACME) the
TLS certificates are in place.
Will start the main HTTP listeners and do some other startup tasks, and then
notify systemd.
Args: Args:
hs (synapse.server.HomeServer) hs (synapse.server.HomeServer)
listeners (list[dict]): Listener configuration ('listeners' in homeserver.yaml) listeners (list[dict]): Listener configuration ('listeners' in homeserver.yaml)
...@@ -311,9 +317,7 @@ def setup_sdnotify(hs): ...@@ -311,9 +317,7 @@ def setup_sdnotify(hs):
# Tell systemd our state, if we're using it. This will silently fail if # Tell systemd our state, if we're using it. This will silently fail if
# we're not using systemd. # we're not using systemd.
hs.get_reactor().addSystemEventTrigger( sdnotify(b"READY=1\nMAINPID=%i" % (os.getpid(),))
"after", "startup", sdnotify, b"READY=1\nMAINPID=%i" % (os.getpid(),)
)
hs.get_reactor().addSystemEventTrigger( hs.get_reactor().addSystemEventTrigger(
"before", "shutdown", sdnotify, b"STOPPING=1" "before", "shutdown", sdnotify, b"STOPPING=1"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment