diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-07-01 10:19:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-01 10:19:27 +0100 |
commit | 8c2825276fec6e03434f1924482788ea3281a9fc (patch) | |
tree | 8bea703d8ce2b1ea757e16a755001f457fa3ccc3 /synapse/state | |
parent | Add documentation for phone home stats (#13086) (diff) | |
download | synapse-8c2825276fec6e03434f1924482788ea3281a9fc.tar.xz |
Skip waiting for full state for incoming events (#13144)
When we receive an event over federation during a faster join, there is no need to wait for full state, since we have a whole reconciliation process designed to take the partial state into account.
Diffstat (limited to 'synapse/state')
-rw-r--r-- | synapse/state/__init__.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py index 9d3fe66100..d5cbdb3eef 100644 --- a/synapse/state/__init__.py +++ b/synapse/state/__init__.py @@ -249,8 +249,12 @@ class StateHandler: partial_state = True logger.debug("calling resolve_state_groups from compute_event_context") + # we've already taken into account partial state, so no need to wait for + # complete state here. entry = await self.resolve_state_groups_for_events( - event.room_id, event.prev_event_ids() + event.room_id, + event.prev_event_ids(), + await_full_state=False, ) state_ids_before_event = entry.state @@ -335,7 +339,7 @@ class StateHandler: @measure_func() async def resolve_state_groups_for_events( - self, room_id: str, event_ids: Collection[str] + self, room_id: str, event_ids: Collection[str], await_full_state: bool = True ) -> _StateCacheEntry: """Given a list of event_ids this method fetches the state at each event, resolves conflicts between them and returns them. @@ -343,6 +347,8 @@ class StateHandler: Args: room_id event_ids + await_full_state: if true, will block if we do not yet have complete + state at these events. Returns: The resolved state @@ -350,7 +356,7 @@ class StateHandler: logger.debug("resolve_state_groups event_ids %s", event_ids) state_groups = await self._state_storage_controller.get_state_group_for_events( - event_ids + event_ids, await_full_state=await_full_state ) state_group_ids = state_groups.values() |