Skip to content

Commit d35ff05

Browse files
authored
Add a timeout message (#809)
To distinguish between errors where an auto-splitter update took too long, from other errors, such as panics, running out of stack space, etc.
1 parent 47a2b51 commit d35ff05

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/auto_splitting/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ fn run<T: event::CommandSink + TimerQuery + Send>(
920920

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

924925
let Ok(mut state) = shared_state.watchdog_state.lock() else {
925926
return;
@@ -944,9 +945,15 @@ fn watchdog<T: event::CommandSink + TimerQuery + Send>(shared_state: Arc<SharedS
944945
};
945946

946947
if result.timed_out() {
948+
if !has_timed_out {
949+
log::error!(target: "Auto Splitter", "timeout, no update in {} seconds", TIMEOUT.as_secs_f32());
950+
has_timed_out = true;
951+
}
947952
if let Some(auto_splitter) = &*shared_state.auto_splitter.load() {
948953
auto_splitter.interrupt_handle().interrupt();
949954
}
955+
} else {
956+
has_timed_out = false;
950957
}
951958

952959
new_state

0 commit comments

Comments
 (0)