summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-12-15 16:14:00 +0000
committerDavid Robertson <davidr@element.io>2022-12-15 16:17:15 +0000
commit922bab1182d243828400531dd5d39753131cc0f3 (patch)
tree6382118fb4e499e6b4b2afa2a9b01714cabeceec
parentPull "tidy up after resync" logic out of the loop (diff)
downloadsynapse-922bab1182d243828400531dd5d39753131cc0f3.tar.xz
Pull out a method to start a resync
-rw-r--r--synapse/handlers/federation.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py

index 741dc15c8a..966889414c 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py
@@ -679,12 +679,8 @@ class FederationHandler: if ret.partial_state: # Kick off the process of asynchronously fetching the state for this # room. - run_as_background_process( - desc="sync_partial_state_room", - func=self._sync_partial_state_room, - initial_destination=origin, - other_destinations=ret.servers_in_room, - room_id=room_id, + await self._start_partial_state_resync( + origin, ret.servers_in_room, room_id ) # We wait here until this instance has seen the events come down @@ -1627,14 +1623,20 @@ class FederationHandler: partial_state_rooms = await self.store.get_partial_state_room_resync_info() for room_id, resync_info in partial_state_rooms.items(): - run_as_background_process( - desc="sync_partial_state_room", - func=self._sync_partial_state_room, - initial_destination=resync_info.joined_via, - other_destinations=resync_info.servers_in_room, - room_id=room_id, + await self._start_partial_state_resync( + resync_info.joined_via, resync_info.servers_in_room, room_id ) + async def _start_partial_state_resync( + self, origin: Optional[str], servers_in_room: List[str], room_id: str + ) -> None: + d = run_as_background_process( + desc="sync_partial_state_room", + func=self._sync_partial_state_room, + initial_destination=origin, + other_destinations=servers_in_room, + room_id=room_id, + ) async def _sync_partial_state_room( self, initial_destination: Optional[str],