Remove failed deferreds from cache

This commit is contained in:
Erik Johnston 2015-08-06 14:01:27 +01:00
parent 433314cc34
commit b811c98574
1 changed files with 7 additions and 1 deletions

View File

@ -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()