mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-17 17:29:13 -04:00
Various clean-ups to the logging context code (#8935)
This commit is contained in:
parent
895e04319b
commit
1619802228
11 changed files with 20 additions and 39 deletions
|
@ -199,8 +199,7 @@ def run_as_background_process(desc: str, func, *args, bg_start_span=True, **kwar
|
|||
_background_process_start_count.labels(desc).inc()
|
||||
_background_process_in_flight_count.labels(desc).inc()
|
||||
|
||||
with BackgroundProcessLoggingContext(desc) as context:
|
||||
context.request = "%s-%i" % (desc, count)
|
||||
with BackgroundProcessLoggingContext(desc, "%s-%i" % (desc, count)) as context:
|
||||
try:
|
||||
ctx = noop_context_manager()
|
||||
if bg_start_span:
|
||||
|
@ -244,8 +243,8 @@ class BackgroundProcessLoggingContext(LoggingContext):
|
|||
|
||||
__slots__ = ["_proc"]
|
||||
|
||||
def __init__(self, name: str):
|
||||
super().__init__(name)
|
||||
def __init__(self, name: str, request: Optional[str] = None):
|
||||
super().__init__(name, request=request)
|
||||
|
||||
self._proc = _BackgroundProcess(name, self)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue