mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 09:34:59 -04:00
Fix up leak. Add warnings.
This commit is contained in:
parent
da1aa07db5
commit
2236ef6c92
8 changed files with 69 additions and 48 deletions
|
@ -132,6 +132,13 @@ class PreserveLoggingContext(object):
|
|||
"""Restores the current logging context"""
|
||||
LoggingContext.thread_local.current_context = self.current_context
|
||||
|
||||
if self.current_context is not LoggingContext.sentinel:
|
||||
if self.current_context.parent_context is None:
|
||||
logger.warn(
|
||||
"Restoring dead context: %s",
|
||||
self.current_context,
|
||||
)
|
||||
|
||||
|
||||
def preserve_context_over_fn(fn, *args, **kwargs):
|
||||
"""Takes a function and invokes it with the given arguments, but removes
|
||||
|
@ -169,6 +176,8 @@ def preserve_context_over_deferred(deferred):
|
|||
res = d.errback(failure)
|
||||
return res
|
||||
|
||||
deferred.addCallbacks(cb, eb)
|
||||
if deferred.called:
|
||||
return deferred
|
||||
|
||||
deferred.addCallbacks(cb, eb)
|
||||
return d
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue