Skip to content

Commit

Permalink
timeout message
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Aug 22, 2024
1 parent eccd5da commit 944a3de
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 944a3de

Please sign in to comment.