Wait for busy guest readiness before measuring shutdown grace
ci / check (push) Failing after 11m45s

This commit is contained in:
Sausage
2026-11-02 00:10:34 +00:00
parent facaf1d9b1
commit c7d478754d
2 changed files with 12 additions and 8 deletions
+9 -8
View File
@@ -1015,6 +1015,7 @@ async fn stop_deadlines() {
async fn shutdown_stops_busy_processes_in_parallel_after_five_seconds() { async fn shutdown_stops_busy_processes_in_parallel_after_five_seconds() {
let w = TestWorld::new(); let w = TestWorld::new();
let h = w.start().await; let h = w.start().await;
let mut notifications = h.subscribe();
let mut tasks = Vec::new(); let mut tasks = Vec::new();
for _ in 0..2 { for _ in 0..2 {
@@ -1024,14 +1025,14 @@ async fn shutdown_stops_busy_processes_in_parallel_after_five_seconds() {
})); }));
} }
tokio::time::timeout(std::time::Duration::from_secs(20), async { tokio::time::timeout(std::time::Duration::from_secs(20), async {
while h // Admission precedes guest startup. Stopping at admission can close
.processes() // stdin before the guest receives its busy request, so there is then
.values() // no busy work that needs the five-second kill budget.
.filter(|p| p.plugin == "probe" && p.method == "busy") let mut ready = 0;
.count() while ready != tasks.len() {
!= 2 if notifications.recv().await.unwrap()["params"]["name"] == "busy-ready" {
{ ready += 1;
tokio::task::yield_now().await; }
} }
}) })
.await .await
+3
View File
@@ -90,6 +90,9 @@ fn wait_eof(lines: &mut Lines) {
std::fs::write("/state/stopped", "yes").unwrap(); std::fs::write("/state/stopped", "yes").unwrap();
} }
fn busy() -> Value { fn busy() -> Value {
send(json!({"jsonrpc":"2.0", "method":"core.notify", "params":{
"name":"busy-ready", "params":{}
}}));
loop { loop {
std::hint::spin_loop(); std::hint::spin_loop();
} }