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

Commit 6c84778

Browse files
authored
Always cache 'event_to_prev_state_group' (#9950)
Fixes regression in send PDU times introduced in #9905.
1 parent 7654735 commit 6c84778

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

changelog.d/9950.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve performance of sending events for worker-based deployments using Redis.

synapse/handlers/message.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,19 +1050,20 @@ async def cache_joined_hosts_for_event(
10501050
)
10511051

10521052
if state_entry.state_group:
1053+
await self._external_cache.set(
1054+
"event_to_prev_state_group",
1055+
event.event_id,
1056+
state_entry.state_group,
1057+
expiry_ms=60 * 60 * 1000,
1058+
)
1059+
10531060
if state_entry.state_group in self._external_cache_joined_hosts_updates:
10541061
return
10551062

10561063
joined_hosts = await self.store.get_joined_hosts(event.room_id, state_entry)
10571064

10581065
# Note that the expiry times must be larger than the expiry time in
10591066
# _external_cache_joined_hosts_updates.
1060-
await self._external_cache.set(
1061-
"event_to_prev_state_group",
1062-
event.event_id,
1063-
state_entry.state_group,
1064-
expiry_ms=60 * 60 * 1000,
1065-
)
10661067
await self._external_cache.set(
10671068
"get_joined_hosts",
10681069
str(state_entry.state_group),

0 commit comments

Comments
 (0)