diff options
author | David Robertson <davidr@element.io> | 2022-05-27 11:17:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-27 11:17:33 +0100 |
commit | 3503f42741d438b67490bc774ee2c3a856f6bc81 (patch) | |
tree | 2b39ed642df3ac4ae149bdde6c13d00edc5683ff /synapse/metrics/background_process_metrics.py | |
parent | Fix room deletion (#12889) (diff) | |
download | synapse-3503f42741d438b67490bc774ee2c3a856f6bc81.tar.xz |
Easy type hints in synapse.logging.opentracing (#12894)
Diffstat (limited to 'synapse/metrics/background_process_metrics.py')
-rw-r--r-- | synapse/metrics/background_process_metrics.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/metrics/background_process_metrics.py b/synapse/metrics/background_process_metrics.py index 298809742a..eef3462e10 100644 --- a/synapse/metrics/background_process_metrics.py +++ b/synapse/metrics/background_process_metrics.py @@ -14,6 +14,7 @@ import logging import threading +from contextlib import nullcontext from functools import wraps from types import TracebackType from typing import ( @@ -41,11 +42,7 @@ from synapse.logging.context import ( LoggingContext, PreserveLoggingContext, ) -from synapse.logging.opentracing import ( - SynapseTags, - noop_context_manager, - start_active_span, -) +from synapse.logging.opentracing import SynapseTags, start_active_span from synapse.metrics._types import Collector if TYPE_CHECKING: @@ -238,7 +235,7 @@ def run_as_background_process( f"bgproc.{desc}", tags={SynapseTags.REQUEST_ID: str(context)} ) else: - ctx = noop_context_manager() + ctx = nullcontext() with ctx: return await func(*args, **kwargs) except Exception: |