mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-17 21:54:30 -05:00
Fix a bug where the joined hosts for a given event were not being properly cached (#14125)
This commit is contained in:
parent
e6e876b9b1
commit
b6baa46db0
1
changelog.d/14125.bugfix
Normal file
1
changelog.d/14125.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix a bug introduced in v1.69.0rc1 where the joined hosts for a given event were not being properly cached.
|
@ -414,7 +414,9 @@ class FederationEventHandler:
|
||||
|
||||
# First, precalculate the joined hosts so that the federation sender doesn't
|
||||
# need to.
|
||||
await self._event_creation_handler.cache_joined_hosts_for_event(event, context)
|
||||
await self._event_creation_handler.cache_joined_hosts_for_events(
|
||||
[(event, context)]
|
||||
)
|
||||
|
||||
await self._check_for_soft_fail(event, context=context, origin=origin)
|
||||
await self._run_push_actions_and_persist_event(event, context)
|
||||
|
@ -1390,7 +1390,7 @@ class EventCreationHandler:
|
||||
extra_users=extra_users,
|
||||
),
|
||||
run_in_background(
|
||||
self.cache_joined_hosts_for_event, event, context
|
||||
self.cache_joined_hosts_for_events, events_and_context
|
||||
).addErrback(
|
||||
log_failure, "cache_joined_hosts_for_event failed"
|
||||
),
|
||||
@ -1491,13 +1491,14 @@ class EventCreationHandler:
|
||||
await self.store.remove_push_actions_from_staging(event.event_id)
|
||||
raise
|
||||
|
||||
async def cache_joined_hosts_for_event(
|
||||
self, event: EventBase, context: EventContext
|
||||
async def cache_joined_hosts_for_events(
|
||||
self, events_and_context: List[Tuple[EventBase, EventContext]]
|
||||
) -> None:
|
||||
"""Precalculate the joined hosts at the event, when using Redis, so that
|
||||
"""Precalculate the joined hosts at each of the given events, when using Redis, so that
|
||||
external federation senders don't have to recalculate it themselves.
|
||||
"""
|
||||
|
||||
for event, _ in events_and_context:
|
||||
if not self._external_cache.is_enabled():
|
||||
return
|
||||
|
||||
@ -1546,7 +1547,9 @@ class EventCreationHandler:
|
||||
expiry_ms=60 * 60 * 1000,
|
||||
)
|
||||
|
||||
self._external_cache_joined_hosts_updates[state_entry.state_group] = None
|
||||
self._external_cache_joined_hosts_updates[
|
||||
state_entry.state_group
|
||||
] = None
|
||||
|
||||
async def _validate_canonical_alias(
|
||||
self,
|
||||
|
Loading…
Reference in New Issue
Block a user