summary refs log tree commit diff
path: root/synapse/util/caches
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/caches
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/caches')
-rw-r--r--synapse/util/caches/descriptors.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/util/caches/descriptors.py b/synapse/util/caches/descriptors.py
index 5c30ed235d..1607978e29 100644
--- a/synapse/util/caches/descriptors.py
+++ b/synapse/util/caches/descriptors.py
@@ -341,7 +341,10 @@ class CacheDescriptor(_CacheDescriptorBase):
                 cache.set(cache_key, result_d, callback=invalidate_callback)
                 observer = result_d.observe()
 
-            return logcontext.make_deferred_yieldable(observer)
+            if isinstance(observer, defer.Deferred):
+                return logcontext.make_deferred_yieldable(observer)
+            else:
+                return observer
 
         wrapped.invalidate = cache.invalidate
         wrapped.invalidate_all = cache.invalidate_all