[object Object]

← back to Exo

handle intermediate state for when config is being updated

2e8227fccbb06e0e137e00e7d78d8d464724867c · 2024-10-24 09:16:46 +0700 · Ian Paul

Files touched

Diff

commit 2e8227fccbb06e0e137e00e7d78d8d464724867c
Author: Ian Paul <iandouglaspaul@gmail.com>
Date:   Thu Oct 24 09:16:46 2024 +0700

    handle intermediate state for when config is being updated
---
 exo/networking/manual/manual_discovery.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/exo/networking/manual/manual_discovery.py b/exo/networking/manual/manual_discovery.py
index f571ce55..961722a7 100644
--- a/exo/networking/manual/manual_discovery.py
+++ b/exo/networking/manual/manual_discovery.py
@@ -101,15 +101,17 @@ class ManualDiscovery(Discovery):
                     f"Current known peers: {[peer.id() for peer in self.known_peers.values()]}"
                 )
 
-    def _get_peers(self):
+  def _get_peers(self):
+    try:
         topology = NetworkTopology.from_path(self.network_config_path)
 
         if self.node_id not in topology.peers:
-            raise ValueError(
-                f"Node ID {self.node_id} not found in network config file {self.network_config_path}. Please run with `node_id` set to one of the keys in the config file: {[k for k, _ in topology.peers]}"
-            )
+          raise ValueError(f"Node ID {self.node_id} not found in network config file {self.network_config_path}. Please run with `node_id` set to one of the keys in the config file: {[k for k, _ in topology.peers]}")
 
         peers_in_network: Dict[str, PeerConfig] = topology.peers
         peers_in_network.pop(self.node_id)
+    except Exception as e:
+        if DEBUG_DISCOVERY >= 2: print(f"Error when loading network config file from {self.network_config_path}. Please update the config file in order to successfully discover peers. Exception: {e}")
+        peers_in_network = {}
 
         return peers_in_network

← 98118bab allow update to manual discovery file  ·  back to Exo  ·  handle when a peer is removed from config, so the known_peer e5eb3259 →