summary refs log tree commit diff
path: root/synapse/util/logcontext.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-28 10:41:08 +0100
committerErik Johnston <erik@matrix.org>2017-03-30 14:14:36 +0100
commit86780a8bc3eac566d2c03a601f84b5ccf5737ceb (patch)
tree196cf1307a234245d4d1642509f64a2f98c09ca5 /synapse/util/logcontext.py
parentFix the logcontext handling in the cache wrappers (#2077) (diff)
downloadsynapse-86780a8bc3eac566d2c03a601f84b5ccf5737ceb.tar.xz
Don't convert to deferreds when not necessary
Diffstat (limited to 'synapse/util/logcontext.py')
-rw-r--r--synapse/util/logcontext.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py
index 857afee7cb..183d9cf62f 100644
--- a/synapse/util/logcontext.py
+++ b/synapse/util/logcontext.py
@@ -315,6 +315,9 @@ def preserve_context_over_deferred(deferred, context=None):
     the deferred follow the synapse logcontext rules: try
     ``make_deferred_yieldable`` instead.
     """
+    if not isinstance(deferred, defer.Deferred):
+        return deferred
+
     if context is None:
         context = LoggingContext.current_context()
     d = _PreservingContextDeferred(context)