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

Commit

Permalink
Don't block for full state to cache hosts in room when sending events
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Dec 29, 2022
1 parent eb9ae47 commit 0fbc1aa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1531,13 +1531,19 @@ async def cache_joined_hosts_for_events(
external federation senders don't have to recalculate it themselves.
"""

for event, _ in events_and_context:
for event, event_context in events_and_context:
if not self._external_cache.is_enabled():
return

# If external cache is enabled we should always have this.
assert self._external_cache_joined_hosts_updates is not None

if event_context.partial_state:
# We can't precalculate joined hosts for a partial-state event,
# (at least not without blocking until full state).
# So skip this calculation entirely.
continue

# We actually store two mappings, event ID -> prev state group,
# state group -> joined hosts, which is much more space efficient
# than event ID -> joined hosts.
Expand Down

0 comments on commit 0fbc1aa

Please sign in to comment.