mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-10 11:51:57 +02:00
Merge branch 'erikj/cache_deferreds' of github.com:matrix-org/synapse into erikj/cache_varargs_interface
This commit is contained in:
commit
2352974aab
1 changed files with 3 additions and 3 deletions
|
@ -184,7 +184,7 @@ class CacheDescriptor(object):
|
||||||
try:
|
try:
|
||||||
cached_result_d = self.cache.get(keyargs)
|
cached_result_d = self.cache.get(keyargs)
|
||||||
|
|
||||||
observed = cached_result_d.observe()
|
observer = cached_result_d.observe()
|
||||||
if DEBUG_CACHES:
|
if DEBUG_CACHES:
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def check_result(cached_result):
|
def check_result(cached_result):
|
||||||
|
@ -197,9 +197,9 @@ class CacheDescriptor(object):
|
||||||
)
|
)
|
||||||
raise ValueError("Stale cache entry")
|
raise ValueError("Stale cache entry")
|
||||||
defer.returnValue(cached_result)
|
defer.returnValue(cached_result)
|
||||||
observed.addCallback(check_result)
|
observer.addCallback(check_result)
|
||||||
|
|
||||||
return observed
|
return observer
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# Get the sequence number of the cache before reading from the
|
# Get the sequence number of the cache before reading from the
|
||||||
# database so that we can tell if the cache is invalidated
|
# database so that we can tell if the cache is invalidated
|
||||||
|
|
Loading…
Reference in a new issue