Skip to content

Commit

Permalink
add items individually
Browse files Browse the repository at this point in the history
  • Loading branch information
ggogel committed Mar 8, 2024
1 parent c95b20c commit 3e642ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions synapse/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,18 @@ async def check_state_independent_auth_rules(
return

# 2. Reject if event has auth_events that: ...
auth_events: MutableMapping[str, "EventBase"]
auth_events: MutableMapping[str, "EventBase"] = {}
if batched_auth_events:
auth_events = batched_auth_events
# Add items individually to prevent locking the whole mapping
for key, value in batched_auth_events.items():
auth_events[key] = value

needed_auth_event_ids = [
event_id
for event_id in event.auth_event_ids()
if event_id not in batched_auth_events
]

if needed_auth_event_ids:
needed_auth_events = await store.get_events(
needed_auth_event_ids,
Expand Down

0 comments on commit 3e642ed

Please sign in to comment.