From 9cf3d5c031b8e991f6216ec3d3ecbd6129e487b3 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Fri, 31 May 2024 20:02:38 -0400 Subject: [PATCH] only 1 timeout message --- src/auto_splitting/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/auto_splitting/mod.rs b/src/auto_splitting/mod.rs index da4631a8..f9e68689 100644 --- a/src/auto_splitting/mod.rs +++ b/src/auto_splitting/mod.rs @@ -840,6 +840,7 @@ async fn watchdog( interrupt_receiver: watch::Receiver>, ) { const TIMEOUT: Duration = Duration::from_secs(5); + let mut has_timed_out = false; loop { let instant = *timeout_receiver.borrow(); @@ -854,7 +855,10 @@ async fn watchdog( Ok(Err(_)) => return, Err(_) => { if let Some(handle) = &*interrupt_receiver.borrow() { - log::error!(target: "Auto Splitter", "timeout, no update in {} seconds", TIMEOUT.as_secs_f32()); + if !has_timed_out { + log::error!(target: "Auto Splitter", "timeout, no update in {} seconds", TIMEOUT.as_secs_f32()); + has_timed_out = true; + } handle.interrupt(); } }