Skip to content

Commit

Permalink
only 1 timeout message
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Jun 1, 2024
1 parent dbb7e62 commit 9cf3d5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/auto_splitting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ async fn watchdog(
interrupt_receiver: watch::Receiver<Option<InterruptHandle>>,
) {
const TIMEOUT: Duration = Duration::from_secs(5);
let mut has_timed_out = false;

loop {
let instant = *timeout_receiver.borrow();
Expand All @@ -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();
}
}
Expand Down

0 comments on commit 9cf3d5c

Please sign in to comment.