瀏覽代碼

update visited with self.id, timeout on collecting topology from a peer 5s

Alex Cheema 11 月之前
父節點
當前提交
80c48b9e76
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      exo/orchestration/standard_node.py

+ 2 - 2
exo/orchestration/standard_node.py

@@ -343,7 +343,7 @@ class StandardNode(Node):
     if DEBUG >= 2: print(f"Collecting topology {max_depth=} {visited=}")
 
     prev_visited = visited.copy()
-    # TODO: should we add our own peer id here?
+    visited.update(self.id)
     visited.update(p.id() for p in self.peers)
 
     for peer in self.peers:
@@ -358,7 +358,7 @@ class StandardNode(Node):
         continue
 
       try:
-        other_topology = await peer.collect_topology(visited, max_depth=max_depth - 1)
+        other_topology = await asyncio.wait_for(peer.collect_topology(visited, max_depth=max_depth - 1), timeout=5.0)
         if DEBUG >= 2: print(f"Collected topology from: {peer.id()}: {other_topology}")
         self.topology.merge(other_topology)
       except Exception as e: