diff options
author | Erik Johnston <erik@matrix.org> | 2024-08-07 17:26:45 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2024-08-07 17:26:45 +0100 |
commit | 2226ef079015273478394f3bbead9c8d3baa1407 (patch) | |
tree | 50ee5f8e0d74b36924698b7fe98bd8eaef1cf1c2 | |
parent | Newsfile (diff) | |
download | synapse-2226ef079015273478394f3bbead9c8d3baa1407.tar.xz |
Filter out lazy loading
-rw-r--r-- | synapse/handlers/sliding_sync.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 5c3af74095..503b8f36ea 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -561,8 +561,6 @@ class SlidingSyncHandler: to_token, ) - all_rooms.update(filtered_sync_room_map) - # Sort the list sorted_room_info = await self.sort_rooms( filtered_sync_room_map, to_token @@ -588,6 +586,18 @@ class SlidingSyncHandler: and StateValues.LAZY in membership_state_keys ) + if lazy_loading: + # Exclude partially-stated rooms unless the `required_state` + # only has `["m.room.member", "$LAZY"]` for membership + # (lazy-loading room members). + filtered_sync_room_map = { + room_id: room + for room_id, room in filtered_sync_room_map.items() + if room_id not in partial_state_room_map + } + + all_rooms.update(filtered_sync_room_map) + ops: List[SlidingSyncResult.SlidingWindowList.Operation] = [] if list_config.ranges: for range in list_config.ranges: @@ -605,15 +615,6 @@ class SlidingSyncHandler: if len(room_ids_in_list) >= max_num_rooms: break - # Exclude partially-stated rooms unless the `required_state` - # only has `["m.room.member", "$LAZY"]` for membership - # (lazy-loading room members). - if ( - partial_state_room_map.get(room_id) - and not lazy_loading - ): - continue - # Take the superset of the `RoomSyncConfig` for each room. # # Update our `relevant_room_map` with the room we're going |