Skip to content

Commit

Permalink
timeout message
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Nov 16, 2024
1 parent 47a2b51 commit 0b7b18b
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 @@ -920,6 +920,7 @@ fn run<T: event::CommandSink + TimerQuery + Send>(

fn watchdog<T: event::CommandSink + TimerQuery + Send>(shared_state: Arc<SharedState<T>>) {
const TIMEOUT: Duration = Duration::from_secs(5);
let mut has_timed_out = false;

let Ok(mut state) = shared_state.watchdog_state.lock() else {
return;
Expand All @@ -944,6 +945,10 @@ fn watchdog<T: event::CommandSink + TimerQuery + Send>(shared_state: Arc<SharedS
};

if result.timed_out() {
if !has_timed_out {
log::error!(target: "Auto Splitter", "timeout, no update in {} seconds", TIMEOUT.as_secs_f32());
has_timed_out = true;
}
if let Some(auto_splitter) = &*shared_state.auto_splitter.load() {
auto_splitter.interrupt_handle().interrupt();
}
Expand Down

0 comments on commit 0b7b18b

Please sign in to comment.