Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix SIGHUP handler #8697

Merged
merged 1 commit into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8697.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Re-organize the structured logging code to separate the TCP transport handling from the JSON formatting.
5 changes: 2 additions & 3 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def register_sighup(func, *args, **kwargs):

Args:
func (function): Function to be called when sent a SIGHUP signal.
Will be called with a single default argument, the homeserver.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to remove the implicit hs param rather than change _reload_logging_config to ignore it, since it seemed more confusing than helpful.

*args, **kwargs: args and kwargs to be passed to the target function.
"""
_sighup_callbacks.append((func, args, kwargs))
Expand Down Expand Up @@ -251,13 +250,13 @@ def handle_sighup(*args, **kwargs):
sdnotify(b"RELOADING=1")

for i, args, kwargs in _sighup_callbacks:
i(hs, *args, **kwargs)
i(*args, **kwargs)

sdnotify(b"READY=1")

signal.signal(signal.SIGHUP, handle_sighup)

register_sighup(refresh_certificate)
register_sighup(refresh_certificate, hs)

# Load the certificate from disk.
refresh_certificate(hs)
Expand Down