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

Commit 158782c

Browse files
authored
Skip soft fail checks for rooms with partial state (#13354)
When a room has the partial state flag, we may not have an accurate `m.room.member` event for event senders in the room's current state, and so cannot perform soft fail checks correctly. Skip the soft fail check entirely in this case. As an alternative, we could block until we have full state, but that would prevent us from receiving incoming events over federation, which is undesirable. Signed-off-by: Sean Quah <[email protected]>
1 parent 86e366a commit 158782c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

changelog.d/13354.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Faster room joins: skip soft fail checks while Synapse only has partial room state, since the current membership of event senders may not be accurately known.

synapse/handlers/federation_event.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,11 +1664,21 @@ async def _check_for_soft_fail(
16641664
"""Checks if we should soft fail the event; if so, marks the event as
16651665
such.
16661666
1667+
Does nothing for events in rooms with partial state, since we may not have an
1668+
accurate membership event for the sender in the current state.
1669+
16671670
Args:
16681671
event
16691672
state_ids: The state at the event if we don't have all the event's prev events
16701673
origin: The host the event originates from.
16711674
"""
1675+
if await self._store.is_partial_state_room(event.room_id):
1676+
# We might not know the sender's membership in the current state, so don't
1677+
# soft fail anything. Even if we do have a membership for the sender in the
1678+
# current state, it may have been derived from state resolution between
1679+
# partial and full state and may not be accurate.
1680+
return
1681+
16721682
extrem_ids_list = await self._store.get_latest_event_ids_in_room(event.room_id)
16731683
extrem_ids = set(extrem_ids_list)
16741684
prev_event_ids = set(event.prev_event_ids())

0 commit comments

Comments
 (0)