Skip to content
Snippets Groups Projects
Unverified Commit 158782c3 authored by Sean Quah's avatar Sean Quah Committed by GitHub
Browse files

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: default avatarSean Quah <seanq@matrix.org>
parent 86e366a4
No related branches found
No related tags found
No related merge requests found
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.
...@@ -1664,11 +1664,21 @@ class FederationEventHandler: ...@@ -1664,11 +1664,21 @@ class FederationEventHandler:
"""Checks if we should soft fail the event; if so, marks the event as """Checks if we should soft fail the event; if so, marks the event as
such. such.
Does nothing for events in rooms with partial state, since we may not have an
accurate membership event for the sender in the current state.
Args: Args:
event event
state_ids: The state at the event if we don't have all the event's prev events state_ids: The state at the event if we don't have all the event's prev events
origin: The host the event originates from. origin: The host the event originates from.
""" """
if await self._store.is_partial_state_room(event.room_id):
# We might not know the sender's membership in the current state, so don't
# soft fail anything. Even if we do have a membership for the sender in the
# current state, it may have been derived from state resolution between
# partial and full state and may not be accurate.
return
extrem_ids_list = await self._store.get_latest_event_ids_in_room(event.room_id) extrem_ids_list = await self._store.get_latest_event_ids_in_room(event.room_id)
extrem_ids = set(extrem_ids_list) extrem_ids = set(extrem_ids_list)
prev_event_ids = set(event.prev_event_ids()) prev_event_ids = set(event.prev_event_ids())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment