diff options
author | David Robertson <davidr@element.io> | 2021-10-06 11:20:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 11:20:49 +0100 |
commit | f8d0f72b27e158738f3c75a38399b967f7478011 (patch) | |
tree | ad1848e462ac985017f62f96734cfd3164c7768f /synapse/util/daemonize.py | |
parent | Remove "reference" wording according Synapse homeserver (#10971) (diff) | |
download | synapse-f8d0f72b27e158738f3c75a38399b967f7478011.tar.xz |
More types for synapse.util, part 1 (#10888)
The following modules now pass `disallow_untyped_defs`: * synapse.util.caches.cached_call * synapse.util.caches.lrucache * synapse.util.caches.response_cache * synapse.util.caches.stream_change_cache * synapse.util.caches.ttlcache pass * synapse.util.daemonize * synapse.util.patch_inline_callbacks pass `no-untyped-defs` * synapse.util.versionstring Additional typing in synapse.util.metrics. Didn't get this to pass `no-untyped-defs`, think I'll need to watch #10847
Diffstat (limited to 'synapse/util/daemonize.py')
-rw-r--r-- | synapse/util/daemonize.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/util/daemonize.py b/synapse/util/daemonize.py index f1a351cfd4..de04f34e4e 100644 --- a/synapse/util/daemonize.py +++ b/synapse/util/daemonize.py @@ -19,6 +19,8 @@ import logging import os import signal import sys +from types import FrameType, TracebackType +from typing import NoReturn, Type def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") -> None: @@ -97,7 +99,9 @@ def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") - # (we don't normally expect reactor.run to raise any exceptions, but this will # also catch any other uncaught exceptions before we get that far.) - def excepthook(type_, value, traceback): + def excepthook( + type_: Type[BaseException], value: BaseException, traceback: TracebackType + ) -> None: logger.critical("Unhanded exception", exc_info=(type_, value, traceback)) sys.excepthook = excepthook @@ -119,7 +123,7 @@ def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") - sys.exit(1) # write a log line on SIGTERM. - def sigterm(signum, frame): + def sigterm(signum: signal.Signals, frame: FrameType) -> NoReturn: logger.warning("Caught signal %s. Stopping daemon." % signum) sys.exit(0) |