summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-06 14:01:27 +0100
committerErik Johnston <erik@matrix.org>2015-08-06 14:01:27 +0100
commitb811c9857491c0569ae367708721fbbaebf3adab (patch)
tree146db37c9e180c67ebc8d5d120ac5e22a029120d /synapse/storage
parentRe-implement DEBUG_CACHES flag (diff)
downloadsynapse-b811c9857491c0569ae367708721fbbaebf3adab.tar.xz
Remove failed deferreds from cache
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/_base.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 8384299a13..99c0948754 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -205,8 +205,14 @@ class CacheDescriptor(object):
                     self.function_to_call,
                     obj, *args, **kwargs
                 )
-                ret = ObservableDeferred(ret, consumeErrors=False)
 
+                def onErr(f):
+                    cache.invalidate(*keyargs)
+                    return f
+
+                ret.addErrback(onErr)
+
+                ret = ObservableDeferred(ret, consumeErrors=False)
                 cache.update(sequence, *(keyargs + [ret]))
 
                 return ret.observe()