Faster joins: do not wait for full state when creating events to send (#14403)
Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
This commit is contained in:
parent
115f0eb233
commit
75888c2b1f
|
@ -0,0 +1 @@
|
||||||
|
Faster joins: do not wait for full state when creating events to send.
|
|
@ -128,6 +128,7 @@ class EventBuilder:
|
||||||
state_filter=StateFilter.from_types(
|
state_filter=StateFilter.from_types(
|
||||||
auth_types_for_event(self.room_version, self)
|
auth_types_for_event(self.room_version, self)
|
||||||
),
|
),
|
||||||
|
await_full_state=False,
|
||||||
)
|
)
|
||||||
auth_event_ids = self._event_auth_handler.compute_auth_events(
|
auth_event_ids = self._event_auth_handler.compute_auth_events(
|
||||||
self, state_ids
|
self, state_ids
|
||||||
|
|
|
@ -190,6 +190,7 @@ class StateHandler:
|
||||||
room_id: str,
|
room_id: str,
|
||||||
event_ids: Collection[str],
|
event_ids: Collection[str],
|
||||||
state_filter: Optional[StateFilter] = None,
|
state_filter: Optional[StateFilter] = None,
|
||||||
|
await_full_state: bool = True,
|
||||||
) -> StateMap[str]:
|
) -> StateMap[str]:
|
||||||
"""Fetch the state after each of the given event IDs. Resolve them and return.
|
"""Fetch the state after each of the given event IDs. Resolve them and return.
|
||||||
|
|
||||||
|
@ -200,13 +201,18 @@ class StateHandler:
|
||||||
Args:
|
Args:
|
||||||
room_id: the room_id containing the given events.
|
room_id: the room_id containing the given events.
|
||||||
event_ids: the events whose state should be fetched and resolved.
|
event_ids: the events whose state should be fetched and resolved.
|
||||||
|
await_full_state: if `True`, will block if we do not yet have complete state
|
||||||
|
at the given `event_id`s, regardless of whether `state_filter` is
|
||||||
|
satisfied by partial state.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the state dict (a mapping from (event_type, state_key) -> event_id) which
|
the state dict (a mapping from (event_type, state_key) -> event_id) which
|
||||||
holds the resolution of the states after the given event IDs.
|
holds the resolution of the states after the given event IDs.
|
||||||
"""
|
"""
|
||||||
logger.debug("calling resolve_state_groups from compute_state_after_events")
|
logger.debug("calling resolve_state_groups from compute_state_after_events")
|
||||||
ret = await self.resolve_state_groups_for_events(room_id, event_ids)
|
ret = await self.resolve_state_groups_for_events(
|
||||||
|
room_id, event_ids, await_full_state
|
||||||
|
)
|
||||||
return await ret.get_state(self._state_storage_controller, state_filter)
|
return await ret.get_state(self._state_storage_controller, state_filter)
|
||||||
|
|
||||||
async def get_current_user_ids_in_room(
|
async def get_current_user_ids_in_room(
|
||||||
|
|
Loading…
Reference in New Issue