ISSUE #468 - After managing to reproduce it with Robert, this should fix the actual issue. The actual problem was checked subtraction in a timer loop carefully checking for the negative - which isn't allowed - and then doing it anyway. Oops.

This commit is contained in:
Herbert Wolverson 2024-05-23 09:55:48 -05:00
parent 667fec63e9
commit 12721dff85

View File

@ -122,9 +122,9 @@ pub async fn update_total_throughput_buffer() {
loop {
let now = Instant::now();
THROUGHPUT_BUFFER.tick().await;
let wait_time = Duration::from_secs(1) - now.elapsed();
if wait_time.as_micros() > 0 {
rocket::tokio::time::sleep(Duration::from_secs(1)).await;
let elapsed = now.elapsed();
if elapsed < Duration::from_secs(1) {
rocket::tokio::time::sleep(Duration::from_secs(1) - elapsed).await;
}
}
}