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

Commit

Permalink
Fix 'rejected_events_metadata' background update (#9537)
Browse files Browse the repository at this point in the history
Turns out matrix.org has an event that has duplicate auth events (which really isn't supposed to happen, but here we are). This caused the background update to fail due to `UniqueViolation`.
  • Loading branch information
erikjohnston authored Mar 3, 2021
1 parent 922788c commit a4fa044
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/9537.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix rare edge case that caused a background update to fail if the server had rejected an event that had duplicate auth events.
4 changes: 3 additions & 1 deletion synapse/storage/databases/main/events_bg_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,9 @@ def get_rejected_events(
)

if not has_event_auth:
for auth_id in event.auth_event_ids():
# Old, dodgy, events may have duplicate auth events, which we
# need to deduplicate as we have a unique constraint.
for auth_id in set(event.auth_event_ids()):
auth_events.append(
{
"room_id": event.room_id,
Expand Down

0 comments on commit a4fa044

Please sign in to comment.