anonymousland-synapse/synapse/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 Type tests.utils (#13028) 2022-07-05 15:13:47 +01:00
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
batching_queue.py Add types to synapse.util. (#10601) 2021-09-10 17:03:18 +01:00
cancellation.py Generalise the @cancellable annotation so it can be used on functions other than just servlet methods. (#13662) 2022-08-31 11:16:05 +00:00
check_dependencies.py Try to detect borked package installations. (#12244) 2022-03-18 19:03:46 +00:00
daemonize.py Upgrade mypy to version 0.931 (#12030) 2022-02-18 15:57:26 +00:00
distributor.py Use ParamSpec in a few places (#12667) 2022-05-09 10:27:39 +00:00
file_consumer.py Add missing type hints to synapse.logging.context (#11556) 2021-12-14 17:35:28 +00:00
frozenutils.py Consistently use collections.abc.Mapping to check frozendict. (#12564) 2022-04-27 09:00:07 -04:00
gai_resolver.py Add most missing type hints to synapse.util (#11328) 2021-11-16 08:47:36 -05:00
hash.py Add missing type hints to synapse.util (#9982) 2021-05-24 15:32:01 -04:00
httpresourcetree.py Add missing type hints to synapse.app. (#11287) 2021-11-10 15:06:54 -05:00
iterutils.py Encode JSON responses on a thread in C, mk2 (#10905) 2021-09-28 09:37:58 +00:00
linked_list.py Eliminate a few Anys in LruCache type hints (#11453) 2021-11-30 15:39:07 +00:00
logcontext.py Improve the backwards compatibility re-exports of synapse.logging.context (#5617) 2019-07-05 02:32:02 +10:00
logformatter.py Improve the backwards compatibility re-exports of synapse.logging.context (#5617) 2019-07-05 02:32:02 +10:00
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
manhole.py Add missing type hints to synapse.app. (#11287) 2021-11-10 15:06:54 -05:00
metrics.py Fix a memory leak when running the unit tests. (#13798) 2022-09-14 15:29:05 +00:00
module_loader.py Standardise the module interface (#10062) 2021-06-18 12:15:52 +01:00
msisdn.py Add missing type hints to synapse.util (#9982) 2021-05-24 15:32:01 -04:00
patch_inline_callbacks.py Use ParamSpec in a few places (#12667) 2022-05-09 10:27:39 +00:00
ratelimitutils.py Fix rate limit metrics registering twice and misreporting (#13649) 2022-08-30 12:08:29 +01:00
retryutils.py Fix RetryDestinationLimiter re-starting finished log contexts (#12803) 2022-05-19 20:17:10 +01:00
rlimit.py Add types to synapse.util. (#10601) 2021-09-10 17:03:18 +01:00
rust.py Check if Rust lib needs rebuilding. (#13759) 2022-09-12 10:03:42 +00:00
stringutils.py Discard null-containing strings before updating the user directory (#12762) 2022-05-18 11:28:14 +01:00
templates.py Implement a Jinja2 filter to extract localparts from email addresses (#12212) 2022-03-11 15:15:11 +00:00
threepids.py Add a callback to allow modules to deny 3PID (#11854) 2022-02-08 11:20:32 +01:00
wheel_timer.py Prevent memory leak from reoccurring when presence is disabled. (#12656) 2022-05-06 16:41:57 +00:00