diff options
author | Richard van der Hoff <richard@matrix.org> | 2017-11-14 11:22:42 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2017-11-14 11:22:42 +0000 |
commit | 7e6fa29cb5ba1abd8b4f3873b0ef171c7c8aba26 (patch) | |
tree | fefec86e319c859109830b7e1a92dfb07574b90d /synapse/util/logcontext.py | |
parent | Merge pull request #2668 from turt2live/travis/whoami (diff) | |
download | synapse-7e6fa29cb5ba1abd8b4f3873b0ef171c7c8aba26.tar.xz |
Remove preserve_context_over_{fn, deferred}
Both of these functions ae known to leak logcontexts. Replace the remaining calls to them and kill them off.
Diffstat (limited to 'synapse/util/logcontext.py')
-rw-r--r-- | synapse/util/logcontext.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py index 9683cc7265..92b9413a35 100644 --- a/synapse/util/logcontext.py +++ b/synapse/util/logcontext.py @@ -291,37 +291,6 @@ class _PreservingContextDeferred(defer.Deferred): return g -def preserve_context_over_fn(fn, *args, **kwargs): - """Takes a function and invokes it with the given arguments, but removes - and restores the current logging context while doing so. - - If the result is a deferred, call preserve_context_over_deferred before - returning it. - """ - with PreserveLoggingContext(): - res = fn(*args, **kwargs) - - if isinstance(res, defer.Deferred): - return preserve_context_over_deferred(res) - else: - return res - - -def preserve_context_over_deferred(deferred, context=None): - """Given a deferred wrap it such that any callbacks added later to it will - be invoked with the current context. - - Deprecated: this almost certainly doesn't do want you want, ie make - the deferred follow the synapse logcontext rules: try - ``make_deferred_yieldable`` instead. - """ - if context is None: - context = LoggingContext.current_context() - d = _PreservingContextDeferred(context) - deferred.chainDeferred(d) - return d - - def preserve_fn(f): """Wraps a function, to ensure that the current context is restored after return from the function, and that the sentinel context is set once the |