summary refs log tree commit diff
path: root/synapse/metrics/background_process_metrics.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-05-27 11:17:33 +0100
committerGitHub <noreply@github.com>2022-05-27 11:17:33 +0100
commit3503f42741d438b67490bc774ee2c3a856f6bc81 (patch)
tree2b39ed642df3ac4ae149bdde6c13d00edc5683ff /synapse/metrics/background_process_metrics.py
parentFix room deletion (#12889) (diff)
downloadsynapse-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.py9
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: