summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-07-30 09:30:44 +0100
committerGitHub <noreply@github.com>2024-07-30 09:30:44 +0100
commit34306be5aa7ebf7913dd28d048887802dc7e079b (patch)
treedf6b87b9abcafb1ddcc4d4f28cd46a03aef19987 /synapse/storage/databases
parentSliding Sync: Track whether we have sent rooms down to clients (#17447) (diff)
downloadsynapse-34306be5aa7ebf7913dd28d048887802dc7e079b.tar.xz
Only send rooms with updates down sliding sync (#17479)
Rather than always including all rooms in range.

Also adds a pre-filter to rooms that checks the stream change cache to
see if anything might have happened.

Based on #17447

---------

Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r--synapse/storage/databases/main/stream.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/stream.py b/synapse/storage/databases/main/stream.py

index b034361aec..4207e73c7f 100644 --- a/synapse/storage/databases/main/stream.py +++ b/synapse/storage/databases/main/stream.py
@@ -2104,3 +2104,13 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore): return RoomStreamToken(stream=last_position.stream - 1) return None + + def get_rooms_that_might_have_updates( + self, room_ids: StrCollection, from_token: RoomStreamToken + ) -> StrCollection: + """Filters given room IDs down to those that might have updates, i.e. + removes rooms that definitely do not have updates. + """ + return self._events_stream_cache.get_entities_changed( + room_ids, from_token.stream + )