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

Faster joins: Fix spurious errors on incremental sync #15232

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15232.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster joins: Fix a bug introduced in Synapse 1.66 where spurious "Failed to find memberships ..." errors would be logged.
9 changes: 7 additions & 2 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,16 +1226,21 @@ async def _find_missing_partial_state_memberships(
continue

event_with_membership_auth = events_with_membership_auth[member]
is_create = (
clokep marked this conversation as resolved.
Show resolved Hide resolved
event_with_membership_auth.is_state()
and event_with_membership_auth.type == EventTypes.Create
)
is_join = (
event_with_membership_auth.is_state()
and event_with_membership_auth.type == EventTypes.Member
and event_with_membership_auth.state_key == member
and event_with_membership_auth.content.get("membership")
== Membership.JOIN
)
if not is_join:
if not is_create and not is_join:
# The event must include the desired membership as an auth event, unless
# it's the first join event for a given user.
# it's the `m.room.create` event for a room or the first join event for
# a given user.
missing_members.add(member)
auth_event_ids.update(event_with_membership_auth.auth_event_ids())

Expand Down