diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-08-28 21:18:53 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-28 21:18:53 +1000 |
commit | 7dc398586c2156a456d9526ac0e42c1fec9f8143 (patch) | |
tree | e5a21464decddbf9798495a351ddb3dbe6e250e4 /synapse/app/_base.py | |
parent | Fix a cache-invalidation bug for worker-based deployments (#5920) (diff) | |
download | synapse-7dc398586c2156a456d9526ac0e42c1fec9f8143.tar.xz |
Implement a structured logging output system. (#5680)
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r-- | synapse/app/_base.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 69dcf3523f..c30fdeee9a 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -36,18 +36,20 @@ from synapse.util.versionstring import get_version_string logger = logging.getLogger(__name__) +# list of tuples of function, args list, kwargs dict _sighup_callbacks = [] -def register_sighup(func): +def register_sighup(func, *args, **kwargs): """ Register a function to be called when a SIGHUP occurs. Args: func (function): Function to be called when sent a SIGHUP signal. - Will be called with a single argument, the homeserver. + Will be called with a single default argument, the homeserver. + *args, **kwargs: args and kwargs to be passed to the target function. """ - _sighup_callbacks.append(func) + _sighup_callbacks.append((func, args, kwargs)) def start_worker_reactor(appname, config, run_command=reactor.run): @@ -248,8 +250,8 @@ def start(hs, listeners=None): # we're not using systemd. sdnotify(b"RELOADING=1") - for i in _sighup_callbacks: - i(hs) + for i, args, kwargs in _sighup_callbacks: + i(hs, *args, **kwargs) sdnotify(b"READY=1") |