Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 4f4d690

Browse files
author
David Robertson
authored
Allow compute_state_after_events to use partial state (#14676)
* Allow `compute_state_after_events` to use partial state if fetching a subset of state that is trusted during a partial join. * Changelog
1 parent fb60cb1 commit 4f4d690

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

changelog.d/14676.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Faster joins: make `computer_state_after_events` consistent with other state-fetching functions that take a `StateFilter`.

synapse/state/__init__.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,20 @@ async def compute_state_after_events(
202202
room_id: the room_id containing the given events.
203203
event_ids: the events whose state should be fetched and resolved.
204204
await_full_state: if `True`, will block if we do not yet have complete state
205-
at the given `event_id`s, regardless of whether `state_filter` is
206-
satisfied by partial state.
205+
at these events and `state_filter` is not satisfied by partial state.
206+
Defaults to `True`.
207207
208208
Returns:
209209
the state dict (a mapping from (event_type, state_key) -> event_id) which
210210
holds the resolution of the states after the given event IDs.
211211
"""
212212
logger.debug("calling resolve_state_groups from compute_state_after_events")
213+
if (
214+
await_full_state
215+
and state_filter
216+
and not state_filter.must_await_full_state(self.hs.is_mine_id)
217+
):
218+
await_full_state = False
213219
ret = await self.resolve_state_groups_for_events(
214220
room_id, event_ids, await_full_state
215221
)

0 commit comments

Comments
 (0)