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

When restarting a partial join resync, prioritise the server which actioned a partial join #14126

Merged
merged 17 commits into from
Oct 18, 2022
Merged
5 changes: 3 additions & 2 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ async def _resume_sync_partial_state_room(self) -> None:
async def _sync_partial_state_room(
self,
initial_destination: Optional[str],
other_destinations: Collection[str],
other_destinations: Sequence[str],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why this is needed? _prioritise_destinations_for_partial_state_resync takes a Collection, not a Sequence.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might have been a left-over from a WIP version before I pulled out the helper. (Or maybe I was trying to express "we preserve the iteration order of other_destinations"? 🤷 )

Copy link
Contributor Author

@DMRobertson DMRobertson Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 1ccf9b8, in any case

room_id: str,
) -> None:
"""Background process to resync the state of a partial-state room
Expand Down Expand Up @@ -1738,6 +1738,7 @@ async def _sync_partial_state_room(
destination,
)


def _prioritise_destinations_for_partial_state_resync(
initial_destination: Optional[str], other_destinations: Collection[str]
) -> Sequence[str]:
Expand All @@ -1753,5 +1754,5 @@ def _prioritise_destinations_for_partial_state_resync(
destinations.remove(initial_destination)
destinations = [initial_destination] + destinations
else:
destinations = other_destinations
destinations = list(other_destinations)
return destinations