From 456a394bf7ee3e802055eb38c0079830df3989df Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 20 May 2022 15:13:06 +0100 Subject: Use 'get_domains_from_state' still for backfill --- synapse/handlers/federation.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 3843c304f7..287ed9b2e8 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -362,11 +362,15 @@ class FederationHandler: # First we try hosts that are already in the room # TODO: HEURISTIC ALERT. - users_in_room = await self.store.get_users_in_room(room_id) - likely_domains = {get_domain_from_id(u) for u in users_in_room} - likely_domains.discard(self.server_name) + curr_state = await self.store.get_current_state(room_id) - async def try_backfill(domains: Collection[str]) -> bool: + curr_domains = get_domains_from_state(curr_state) + + likely_domains = [ + domain for domain, depth in curr_domains if domain != self.server_name + ] + + async def try_backfill(domains: List[str]) -> bool: # TODO: Should we try multiple of these at a time? for dom in domains: try: -- cgit 1.5.1