summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-05-22 16:23:39 +0100
committerErik Johnston <erik@matrix.org>2018-05-22 16:23:39 +0100
commitcb2a2ad791155bd1e1ef58caa2ef2894a74fab08 (patch)
tree581b2a0880d8ae458c28b9e662f1e527df49a8e7 /synapse
parentMerge pull request #3236 from matrix-org/rav/consent_notice (diff)
downloadsynapse-cb2a2ad791155bd1e1ef58caa2ef2894a74fab08.tar.xz
get_domains_from_state returns list of tuples
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/federation.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index ba3ede8024..c85d194511 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -751,6 +751,16 @@ class FederationHandler(BaseHandler):
         curr_state = yield self.state_handler.get_current_state(room_id)
 
         def get_domains_from_state(state):
+            """Get joined domains from state
+
+            Args:
+                state (dict[tuple, FrozenEvent]): State map from type/state
+                    key to event.
+
+            Returns:
+                list[tuple[str, int]]: Returns a list of servers with the
+                lowest depth of their joins. Sorted by lowest depth first.
+            """
             joined_users = [
                 (state_key, int(event.depth))
                 for (e_type, state_key), event in state.items()
@@ -861,13 +871,13 @@ class FederationHandler(BaseHandler):
             likely_domains = get_domains_from_state(states[e_id])
 
             success = yield try_backfill([
-                dom for dom in likely_domains
+                dom for dom, _ in likely_domains
                 if dom not in tried_domains
             ])
             if success:
                 defer.returnValue(True)
 
-            tried_domains.update(likely_domains)
+            tried_domains.update(dom for dom, _ in likely_domains)
 
         defer.returnValue(False)