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

Commit 2eb45cc

Browse files
Mathieu Veltensquahtx
authored andcommitted
Faster joins: use initial list of servers if we don't have the full state yet (#14408)
Signed-off-by: Mathieu Velten <[email protected]> Co-authored-by: Sean Quah <[email protected]>
1 parent 08b33b5 commit 2eb45cc

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Diff for: changelog.d/14408.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Faster joins: send events to initial list of servers if we don't have the full state yet.

Diff for: synapse/federation/sender/__init__.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,23 @@ async def handle_event(event: EventBase) -> None:
434434
# If there are no prev event IDs then the state is empty
435435
# and so no remote servers in the room
436436
destinations = set()
437-
else:
437+
438+
if destinations is None:
439+
# During partial join we use the set of servers that we got
440+
# when beginning the join. It's still possible that we send
441+
# events to servers that left the room in the meantime, but
442+
# we consider that an acceptable risk since it is only our own
443+
# events that we leak and not other server's ones.
444+
partial_state_destinations = (
445+
await self.store.get_partial_state_servers_at_join(
446+
event.room_id
447+
)
448+
)
449+
450+
if len(partial_state_destinations) > 0:
451+
destinations = partial_state_destinations
452+
453+
if destinations is None:
438454
# We check the external cache for the destinations, which is
439455
# stored per state group.
440456

0 commit comments

Comments
 (0)