From 34306be5aa7ebf7913dd28d048887802dc7e079b Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 30 Jul 2024 09:30:44 +0100 Subject: 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 --- synapse/storage/databases/main/stream.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'synapse/storage/databases') 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 + ) -- cgit 1.5.1