synapse/tests/util
Eric Eastwood 29269d9d3f
Fix have_seen_event cache not being invalidated (#13863)
Fix https://github.com/matrix-org/synapse/issues/13856
Fix https://github.com/matrix-org/synapse/issues/13865

> Discovered while trying to make Synapse fast enough for [this MSC2716 test for importing many batches](https://github.com/matrix-org/complement/pull/214#discussion_r741678240). As an example, disabling the `have_seen_event` cache saves 10 seconds for each `/messages` request in that MSC2716 Complement test because we're not making as many federation requests for `/state` (speeding up `have_seen_event` itself is related to https://github.com/matrix-org/synapse/issues/13625) 
> 
> But this will also make `/messages` faster in general so we can include it in the [faster `/messages` milestone](https://github.com/matrix-org/synapse/milestone/11).
> 
> *-- https://github.com/matrix-org/synapse/issues/13856*


### The problem

`_invalidate_caches_for_event` doesn't run in monolith mode which means we never even tried to clear the `have_seen_event` and other caches. And even in worker mode, it only runs on the workers, not the master (AFAICT).

Additionally there was bug with the key being wrong so `_invalidate_caches_for_event` never invalidates the `have_seen_event` cache even when it does run.

Because we were using the `@cachedList` wrong, it was putting items in the cache under keys like `((room_id, event_id),)` with a `set` in a `set` (ex. `(('!TnCIJPKzdQdUlIyXdQ:test', '$Iu0eqEBN7qcyF1S9B3oNB3I91v2o5YOgRNPwi_78s-k'),)`) and we we're trying to invalidate with just `(room_id, event_id)` which did nothing.
2022-09-27 15:55:43 -05:00
..
caches Fix have_seen_event cache not being invalidated (#13863) 2022-09-27 15:55:43 -05:00
__init__.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_async_helpers.py Immediately retry any requests that have backed off when a server comes back online. (#12500) 2022-05-10 10:39:54 +01:00
test_batching_queue.py Rewrite the KeyRing (#10035) 2021-06-02 16:37:59 +01:00
test_check_dependencies.py Try to detect borked package installations. (#12244) 2022-03-18 19:03:46 +00:00
test_dict_cache.py Make DictionaryCache have better expiry properties (#13292) 2022-07-21 17:13:44 +01:00
test_expiring_cache.py Replace assertEquals and friends with non-deprecated versions. (#12092) 2022-02-28 07:12:29 -05:00
test_file_consumer.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_itertools.py Use inline type hints in tests/ (#10350) 2021-07-13 11:52:58 +01:00
test_linearizer.py Fix edge case where a Linearizer could get stuck (#12358) 2022-04-05 17:19:16 +01:00
test_logcontext.py Replace assertEquals and friends with non-deprecated versions. (#12092) 2022-02-28 07:12:29 -05:00
test_logformatter.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_lrucache.py Add config flags to allow for cache auto-tuning (#12701) 2022-05-13 12:32:39 -07:00
test_macaroons.py Move the "email unsubscribe" resource, refactor the macaroon generator & simplify the access token verification logic. (#12986) 2022-06-14 09:12:08 -04:00
test_ratelimitutils.py Use direct references for configuration variables (part 4). (#10893) 2021-09-23 12:03:01 -04:00
test_retryutils.py Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
test_rwlock.py Update docstrings for ReadWriteLock tests (#12354) 2022-04-05 16:54:40 +01:00
test_stream_change_cache.py Update black, and run auto formatting over the codebase (#9381) 2021-02-16 22:32:34 +00:00
test_stringutils.py Change the format of access tokens away from macaroons (#5588) 2021-05-12 15:04:51 +01:00
test_threepids.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_treecache.py Replace assertEquals and friends with non-deprecated versions. (#12092) 2022-02-28 07:12:29 -05:00
test_wheel_timer.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00