[control] Fix round 4: a device change during an engine switch is never skipped silently (devices_problem until the serving engine is told), and every switch ends by telling the engine that serves, also after going back

This commit is contained in:
2026-11-08 12:48:57 +01:00
parent c45dafa2a3
commit 0213021bb1
4 changed files with 60 additions and 22 deletions
+8 -2
View File
@@ -78,6 +78,12 @@ esac
let deadline = Instant::now() + Duration::from_secs(30);
loop {
let r = env.call("GET", "/api/v1/engine", None).await;
// On a loaded machine a switch takes longer: stay under the API's 120 calls a
// minute rather than fail on a 429.
if r.status == 429 {
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
}
assert_eq!(r.status, 200, "{}", r.text);
if r.json["state"] == "running" && r.json["running"] == running {
return r.json;
@@ -85,7 +91,7 @@ esac
if Instant::now() > deadline {
panic!("engine is {}\n{}", r.text, env.control_log());
}
tokio::time::sleep(Duration::from_millis(100)).await;
tokio::time::sleep(Duration::from_millis(300)).await;
}
}
@@ -654,7 +660,7 @@ esac
return;
}
assert!(Instant::now() < deadline, "never {state}: {}", r.text);
tokio::time::sleep(Duration::from_millis(100)).await;
tokio::time::sleep(Duration::from_millis(250)).await;
}
}