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