summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-11-14 23:00:10 +0000
committerRichard van der Hoff <richard@matrix.org>2017-11-14 23:00:10 +0000
commitb2cd6accf5e584cbaf7f3c6b44addb06a883a222 (patch)
treecd23e78070461cb370ec7c354298261b44a7de10 /synapse/util
parentRemove preserve_context_over_{fn, deferred} (diff)
downloadsynapse-b2cd6accf5e584cbaf7f3c6b44addb06a883a222.tar.xz
Remove __PreservingContextDeferred too
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/logcontext.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py
index 92b9413a35..48c9f6802d 100644
--- a/synapse/util/logcontext.py
+++ b/synapse/util/logcontext.py
@@ -261,36 +261,6 @@ class PreserveLoggingContext(object):
                 )
 
 
-class _PreservingContextDeferred(defer.Deferred):
-    """A deferred that ensures that all callbacks and errbacks are called with
-    the given logging context.
-    """
-    def __init__(self, context):
-        self._log_context = context
-        defer.Deferred.__init__(self)
-
-    def addCallbacks(self, callback, errback=None,
-                     callbackArgs=None, callbackKeywords=None,
-                     errbackArgs=None, errbackKeywords=None):
-        callback = self._wrap_callback(callback)
-        errback = self._wrap_callback(errback)
-        return defer.Deferred.addCallbacks(
-            self, callback,
-            errback=errback,
-            callbackArgs=callbackArgs,
-            callbackKeywords=callbackKeywords,
-            errbackArgs=errbackArgs,
-            errbackKeywords=errbackKeywords,
-        )
-
-    def _wrap_callback(self, f):
-        def g(res, *args, **kwargs):
-            with PreserveLoggingContext(self._log_context):
-                res = f(res, *args, **kwargs)
-            return res
-        return g
-
-
 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