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

Commit

Permalink
Faster joins: use initial list of servers if we don't have the full s…
Browse files Browse the repository at this point in the history
…tate yet (#14408)


Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
  • Loading branch information
2 people authored and H-Shay committed Dec 13, 2022
1 parent 08b33b5 commit 2eb45cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/14408.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster joins: send events to initial list of servers if we don't have the full state yet.
18 changes: 17 additions & 1 deletion synapse/federation/sender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,23 @@ async def handle_event(event: EventBase) -> None:
# If there are no prev event IDs then the state is empty
# and so no remote servers in the room
destinations = set()
else:

if destinations is None:
# During partial join we use the set of servers that we got
# when beginning the join. It's still possible that we send
# events to servers that left the room in the meantime, but
# we consider that an acceptable risk since it is only our own
# events that we leak and not other server's ones.
partial_state_destinations = (
await self.store.get_partial_state_servers_at_join(
event.room_id
)
)

if len(partial_state_destinations) > 0:
destinations = partial_state_destinations

if destinations is None:
# We check the external cache for the destinations, which is
# stored per state group.

Expand Down

0 comments on commit 2eb45cc

Please sign in to comment.