diff options
author | Sean Quah <8349537+squahtx@users.noreply.github.com> | 2022-07-26 12:39:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 12:39:23 +0100 |
commit | 335ebb21ccc0ae906169f21dcfc456c869bdd301 (patch) | |
tree | d79c423c2592b719fe02ffc6bb6f40f5f4416aed /synapse/storage/controllers | |
parent | Remove unused argument for get_relations_for_event. (#13383) (diff) | |
download | synapse-335ebb21ccc0ae906169f21dcfc456c869bdd301.tar.xz |
Faster room joins: avoid blocking when pulling events with missing prevs (#13355)
Avoid blocking on full state in `_resolve_state_at_missing_prevs` and return a new flag indicating whether the resolved state is partial. Thread that flag around so that it makes it into the event context. Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Diffstat (limited to 'synapse/storage/controllers')
-rw-r--r-- | synapse/storage/controllers/state.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/controllers/state.py b/synapse/storage/controllers/state.py index e08f956e6e..20805c94fa 100644 --- a/synapse/storage/controllers/state.py +++ b/synapse/storage/controllers/state.py @@ -82,13 +82,15 @@ class StateStorageController: return state_group_delta.prev_group, state_group_delta.delta_ids async def get_state_groups_ids( - self, _room_id: str, event_ids: Collection[str] + self, _room_id: str, event_ids: Collection[str], await_full_state: bool = True ) -> Dict[int, MutableStateMap[str]]: """Get the event IDs of all the state for the state groups for the given events Args: _room_id: id of the room for these events event_ids: ids of the events + await_full_state: if `True`, will block if we do not yet have complete + state at these events. Returns: dict of state_group_id -> (dict of (type, state_key) -> event id) @@ -100,7 +102,9 @@ class StateStorageController: if not event_ids: return {} - event_to_groups = await self.get_state_group_for_events(event_ids) + event_to_groups = await self.get_state_group_for_events( + event_ids, await_full_state=await_full_state + ) groups = set(event_to_groups.values()) group_to_state = await self.stores.state._get_state_for_groups(groups) |