diff options
author | Nick Mills-Barrett <nick@beeper.com> | 2022-10-17 13:27:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 13:27:51 +0100 |
commit | 2c2c3f8b2c1e33d5aee6d480c60c75c1179e3dba (patch) | |
tree | 730b642bf49bd2f0232a154a0b3ae7270e3b12e7 | |
parent | Fix dead link to admin registration API (#14189) (diff) | |
download | synapse-2c2c3f8b2c1e33d5aee6d480c60c75c1179e3dba.tar.xz |
Invalidate rooms for user caches when receiving membership events (#14155)
This should fix a race where the event notification comes in over replication before the state replication, leaving a window during which a sync may get an incorrect list of rooms for the user.
-rw-r--r-- | changelog.d/14155.misc | 1 | ||||
-rw-r--r-- | synapse/storage/databases/main/cache.py | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/changelog.d/14155.misc b/changelog.d/14155.misc new file mode 100644 index 0000000000..79539cdc32 --- /dev/null +++ b/changelog.d/14155.misc @@ -0,0 +1 @@ +Invalidate rooms for user caches on replicated event, fix sync cache race in synapse workers. Contributed by Nick @ Beeper (@fizzadar). diff --git a/synapse/storage/databases/main/cache.py b/synapse/storage/databases/main/cache.py index ed0be4abe5..ddb7397714 100644 --- a/synapse/storage/databases/main/cache.py +++ b/synapse/storage/databases/main/cache.py @@ -252,6 +252,10 @@ class CacheInvalidationWorkerStore(SQLBaseStore): self._attempt_to_invalidate_cache( "get_invited_rooms_for_local_user", (state_key,) ) + self._attempt_to_invalidate_cache( + "get_rooms_for_user_with_stream_ordering", (state_key,) + ) + self._attempt_to_invalidate_cache("get_rooms_for_user", (state_key,)) if relates_to: self._attempt_to_invalidate_cache("get_relations_for_event", (relates_to,)) |