Post warning if window service isn't receiving any data (#5269)

automerge
This commit is contained in:
Sagar Dhawan 2019-07-24 12:46:10 -07:00 committed by Grimes
parent c3a941086d
commit 937816e67b
1 changed files with 9 additions and 1 deletions

View File

@ -214,6 +214,7 @@ impl WindowService {
.num_threads(sys_info::cpu_num().unwrap_or(NUM_THREADS) as usize)
.build()
.unwrap();
let mut now = Instant::now();
loop {
if exit.load(Ordering::Relaxed) {
break;
@ -237,12 +238,19 @@ impl WindowService {
) {
match e {
Error::RecvTimeoutError(RecvTimeoutError::Disconnected) => break,
Error::RecvTimeoutError(RecvTimeoutError::Timeout) => (),
Error::RecvTimeoutError(RecvTimeoutError::Timeout) => {
if now.elapsed() > Duration::from_secs(30) {
warn!("Window does not seem to be receiving data. Ensure port configuration is correct...");
now = Instant::now();
}
}
_ => {
inc_new_counter_error!("streamer-window-error", 1, 1);
error!("window error: {:?}", e);
}
}
} else {
now = Instant::now();
}
}
})