better unfinished log

This commit is contained in:
Pascal Engélibert 2025-12-19 16:02:53 +01:00
commit 13ce9f1891

View file

@ -157,6 +157,7 @@ pub async fn play(
Ok(v) => v.unwrap().unwrap(),
Err(_e) => {
// TODO fix
println!("client timeout {id}");
break 'repeat;
}
};
@ -279,6 +280,7 @@ pub async fn play(
Ok(v) => v.unwrap().unwrap(),
Err(_e) => {
// TODO fix
println!("client timeout {id}");
break 'repeat;
}
};
@ -309,21 +311,25 @@ pub async fn play(
}
}
}
tokio::spawn(async move {
let mut last_count = 0;
loop {
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
println!("Running: {:?}", running.lock().await);
let new_count = counter.load(std::sync::atomic::Ordering::Relaxed);
if new_count == last_count {
println!("Stalled at {} / {}, stopping", new_count, total);
std::process::exit(0);
tokio::spawn({
let running = running.clone();
async move {
let mut last_count = 0;
loop {
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
println!("Running: {:?}", running.lock().await);
let new_count = counter.load(std::sync::atomic::Ordering::Relaxed);
if new_count == last_count {
println!("Stalled at {} / {}, stopping", new_count, total);
std::process::exit(0);
}
last_count = new_count;
}
last_count = new_count;
}
});
for handle in handles {
handle.await.unwrap();
}
println!("Unfinished: {:?}", running.lock().await);
std::process::exit(0);
}