Skip to content

Commit

Permalink
timeout message
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Sep 21, 2024
1 parent 6ac1ef0 commit 46f16b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/auto_splitting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,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 @@ -876,6 +877,10 @@ async fn watchdog(
Ok(Err(_)) => return,
Err(_) => {
if let Some(handle) = &*interrupt_receiver.borrow() {
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 46f16b7

Please sign in to comment.