Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'rav/cache_hacking/3' into rav/cache_hacking/work
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Oct 21, 2020
2 parents 83b2712 + c13820b commit 8329346
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion synapse/util/caches/deferred_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from prometheus_client import Gauge

from twisted.internet import defer
from twisted.python import failure

from synapse.util.async_helpers import ObservableDeferred
from synapse.util.caches.lrucache import LruCache
Expand Down Expand Up @@ -223,7 +224,9 @@ def set(

# we can save a whole load of effort if the deferred is ready.
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

# otherwise, we'll add an entry to the _pending_deferred_cache for now,
Expand Down

0 comments on commit 8329346

Please sign in to comment.