mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 05:19:27 -05:00
fix failure case
This commit is contained in:
parent
2b3af01791
commit
c13820bcee
@ -31,6 +31,7 @@ from typing import (
|
|||||||
from prometheus_client import Gauge
|
from prometheus_client import Gauge
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
from twisted.python import failure
|
||||||
|
|
||||||
from synapse.util.async_helpers import ObservableDeferred
|
from synapse.util.async_helpers import ObservableDeferred
|
||||||
from synapse.util.caches.lrucache import LruCache
|
from synapse.util.caches.lrucache import LruCache
|
||||||
@ -223,7 +224,9 @@ class DeferredCache(Generic[KT, VT]):
|
|||||||
|
|
||||||
# we can save a whole load of effort if the deferred is ready.
|
# we can save a whole load of effort if the deferred is ready.
|
||||||
if value.called:
|
if value.called:
|
||||||
self.cache.set(key, value.result, callbacks)
|
result = value.result
|
||||||
|
if not isinstance(result, failure.Failure):
|
||||||
|
self.cache.set(key, result, callbacks)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
# otherwise, we'll add an entry to the _pending_deferred_cache for now,
|
# otherwise, we'll add an entry to the _pending_deferred_cache for now,
|
||||||
|
Loading…
Reference in New Issue
Block a user