diff options
author | Sean Quah <seanq@matrix.org> | 2022-08-05 22:31:50 +0100 |
---|---|---|
committer | Sean Quah <seanq@matrix.org> | 2022-08-10 13:08:02 +0100 |
commit | 5274c8779b714e84a61e4807fb68f3961efaf1f6 (patch) | |
tree | 23cd5f72609ef1beb6553119e11802cd522de918 | |
parent | Do not wait for full state in a few cases in `_get_rooms_changed` (diff) | |
download | synapse-5274c8779b714e84a61e4807fb68f3961efaf1f6.tar.xz |
Do not wait for full state in `compute_state_delta`
Signed-off-by: Sean Quah <seanq@matrix.org>
-rw-r--r-- | synapse/handlers/sync.py | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index a10a61363b..d2672378a1 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -964,19 +964,26 @@ class SyncHandler: if batch: state_at_timeline_end = ( await self._state_storage_controller.get_state_ids_for_event( - batch.events[-1].event_id, state_filter=state_filter + batch.events[-1].event_id, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) ) state_at_timeline_start = ( await self._state_storage_controller.get_state_ids_for_event( - batch.events[0].event_id, state_filter=state_filter + batch.events[0].event_id, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) ) else: state_at_timeline_end = await self.get_state_at( - room_id, stream_position=now_token, state_filter=state_filter + room_id, + stream_position=now_token, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) state_at_timeline_start = state_at_timeline_end @@ -992,14 +999,19 @@ class SyncHandler: if batch: state_at_timeline_start = ( await self._state_storage_controller.get_state_ids_for_event( - batch.events[0].event_id, state_filter=state_filter + batch.events[0].event_id, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) ) else: # We can get here if the user has ignored the senders of all # the recent events. state_at_timeline_start = await self.get_state_at( - room_id, stream_position=now_token, state_filter=state_filter + room_id, + stream_position=now_token, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) # for now, we disable LL for gappy syncs - see @@ -1021,20 +1033,28 @@ class SyncHandler: # is indeed the case. assert since_token is not None state_at_previous_sync = await self.get_state_at( - room_id, stream_position=since_token, state_filter=state_filter + room_id, + stream_position=since_token, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) if batch: state_at_timeline_end = ( await self._state_storage_controller.get_state_ids_for_event( - batch.events[-1].event_id, state_filter=state_filter + batch.events[-1].event_id, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) ) else: # We can get here if the user has ignored the senders of all # the recent events. state_at_timeline_end = await self.get_state_at( - room_id, stream_position=now_token, state_filter=state_filter + room_id, + stream_position=now_token, + state_filter=state_filter, + await_full_state=not lazy_load_members, ) state_ids = _calculate_state( @@ -1064,8 +1084,10 @@ class SyncHandler: (EventTypes.Member, member) for member in members_to_fetch ), + await_full_state=False, ) + # FIXME: `state_ids` may be missing memberships for partial state rooms. # At this point, if `lazy_load_members` is enabled, `state_ids` includes # the memberships of all event senders in the timeline. This is because we # may not have sent the memberships in a previous sync. |