synapse-product/synapse/util/caches
Jonathan de Jong f5c93fc993
Fix #8518 (sync requests being cached wrongly on timeout) (#9358)
This fixes #8518 by adding a conditional check on `SyncResult` in a function when `prev_stream_token == current_stream_token`, as a sanity check. In `CachedResponse.set.<remove>()`, the result is immediately popped from the cache if the conditional function returns "false".

This prevents the caching of a timed-out `SyncResult` (that has `next_key` as the stream key that produced that `SyncResult`). The cache is prevented from returning a `SyncResult` that makes the client request the same stream key over and over again, effectively making it stuck in a loop of requesting and getting a response immediately for as long as the cache keeps those values.

Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
2021-02-24 13:57:00 +00:00
..
__init__.py Update black, and run auto formatting over the codebase (#9381) 2021-02-16 22:32:34 +00:00
cached_call.py Clean up caching/locking of OIDC metadata load (#9362) 2021-02-16 16:27:38 +00:00
deferred_cache.py Empty iterables should count towards cache usage. (#9028) 2021-01-06 12:33:20 -05:00
descriptors.py Update black, and run auto formatting over the codebase (#9381) 2021-02-16 22:32:34 +00:00
dictionary_cache.py type annotations for LruCache 2020-10-16 15:56:39 +01:00
expiringcache.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
lrucache.py Fix 'LruCache' object has no attribute '_on_resize' (#8591) 2020-10-19 21:13:50 +01:00
response_cache.py Fix #8518 (sync requests being cached wrongly on timeout) (#9358) 2021-02-24 13:57:00 +00:00
stream_change_cache.py Update black, and run auto formatting over the codebase (#9381) 2021-02-16 22:32:34 +00:00
treecache.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
ttlcache.py Enable mypy for synapse.util.caches (#8547) 2020-10-15 11:44:39 +01:00