Parcourir la source

fix: mark unreachable nodes as unavailable in cluster selection

occupied_nodes now tracks nodes with SSH failures alongside nodes with
running containers, so select_cluster won't pick a cluster where some
nodes are offline but not yet running containers for another recipe.
Alexander Korolev il y a 3 mois
Parent
commit
f54e192ef7
1 fichiers modifiés avec 9 ajouts et 4 suppressions
  1. 9 4
      src/docker/mod.rs

+ 9 - 4
src/docker/mod.rs

@@ -257,10 +257,15 @@ pub async fn occupied_nodes(config: &Config) -> Result<HashSet<String>> {
     }
     let mut occupied = HashSet::new();
     for h in futures::future::join_all(handles).await {
-        if let Ok((name, Ok(output))) = h
-            && !output.trim().is_empty()
-        {
-            occupied.insert(name);
+        match h {
+            Ok((name, Ok(output))) if !output.trim().is_empty() => {
+                occupied.insert(name);
+            }
+            Ok((name, Err(_))) => {
+                // Node is unreachable — mark as unavailable
+                occupied.insert(name);
+            }
+            _ => {}
         }
     }
     Ok(occupied)