summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2022-10-03 14:13:11 +0100
committerGitHub <noreply@github.com>2022-10-03 13:13:11 +0000
commit606b2d9009f0a3e70056dec7e9cdccd0c0d7afed (patch)
tree362ad2d7eb0f44913c085144caeee85190ef2726
parentRefactor `_get_e2e_device_keys_txn` to split large queries (#13956) (diff)
downloadsynapse-606b2d9009f0a3e70056dec7e9cdccd0c0d7afed.tar.xz
Add cache to `get_partial_state_servers_at_join` (#14013)
-rw-r--r--changelog.d/14013.misc1
-rw-r--r--synapse/storage/databases/main/room.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/changelog.d/14013.misc b/changelog.d/14013.misc
new file mode 100644

index 0000000000..499e488c35 --- /dev/null +++ b/changelog.d/14013.misc
@@ -0,0 +1 @@ +Faster room joins: Send device list updates to most servers in rooms with partial state. diff --git a/synapse/storage/databases/main/room.py b/synapse/storage/databases/main/room.py
index 059eef5c22..7412bce255 100644 --- a/synapse/storage/databases/main/room.py +++ b/synapse/storage/databases/main/room.py
@@ -1134,6 +1134,7 @@ class RoomWorkerStore(CacheInvalidationWorkerStore): get_rooms_for_retention_period_in_range_txn, ) + @cached(iterable=True) async def get_partial_state_servers_at_join(self, room_id: str) -> Sequence[str]: """Gets the list of servers in a partial state room at the time we joined it. @@ -1216,6 +1217,9 @@ class RoomWorkerStore(CacheInvalidationWorkerStore): keyvalues={"room_id": room_id}, ) self._invalidate_cache_and_stream(txn, self.is_partial_state_room, (room_id,)) + self._invalidate_cache_and_stream( + txn, self.get_partial_state_servers_at_join, (room_id,) + ) # We now delete anything from `device_lists_remote_pending` with a # stream ID less than the minimum @@ -1862,6 +1866,9 @@ class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore): values=((room_id, s) for s in servers), ) self._invalidate_cache_and_stream(txn, self.is_partial_state_room, (room_id,)) + self._invalidate_cache_and_stream( + txn, self.get_partial_state_servers_at_join, (room_id,) + ) async def write_partial_state_rooms_join_event_id( self,