reduce error logging

This commit is contained in:
Justin Starry 2019-12-19 13:13:37 -05:00 committed by Michael Vines
parent 848fe51f3d
commit a096ade345
1 changed files with 5 additions and 1 deletions

View File

@ -404,6 +404,7 @@ fn poll_blockhash<T: Client>(
id: &Pubkey, id: &Pubkey,
) { ) {
let mut blockhash_last_updated = Instant::now(); let mut blockhash_last_updated = Instant::now();
let mut last_error_log = Instant::now();
loop { loop {
let blockhash_updated = { let blockhash_updated = {
let old_blockhash = *blockhash.read().unwrap(); let old_blockhash = *blockhash.read().unwrap();
@ -416,7 +417,10 @@ fn poll_blockhash<T: Client>(
eprintln!("Blockhash is stuck"); eprintln!("Blockhash is stuck");
exit(1) exit(1)
} else if blockhash_last_updated.elapsed().as_secs() > 30 { } else if blockhash_last_updated.elapsed().as_secs() > 30 {
error!("Blockhash is not updating"); if last_error_log.elapsed().as_secs() >= 1 {
last_error_log = Instant::now();
error!("Blockhash is not updating");
}
} }
false false
} }