error if health checks are failing

This commit is contained in:
Bryan Stitt 2023-07-10 20:59:17 -07:00
parent fe39ad1e1e
commit 04825be99d
2 changed files with 7 additions and 3 deletions

@ -686,7 +686,7 @@ impl ConsensusFinder {
if let Some(max_age) = self.max_head_block_age {
if rpc_head_block.age() > max_age {
trace!("rpc_head_block from {} is too old! {}", rpc, rpc_head_block);
warn!("rpc_head_block from {} is too old! {}", rpc, rpc_head_block);
return Ok(self.remove(&rpc).is_some());
}
}

@ -28,7 +28,7 @@ use std::sync::atomic::{self, AtomicU32, AtomicU64, AtomicUsize};
use std::{cmp::Ordering, sync::Arc};
use tokio::sync::{watch, RwLock as AsyncRwLock};
use tokio::time::{interval, sleep, sleep_until, Duration, Instant, MissedTickBehavior};
use tracing::{debug, info, trace, warn, Level};
use tracing::{debug, error, info, trace, warn, Level};
use url::Url;
/// An active connection to a Web3 RPC server like geth or erigon.
@ -723,7 +723,11 @@ impl Web3Rpc {
if let Err(err) = rpc.healthcheck(error_handler).await {
// TODO: different level depending on the error handler
// TODO: if rate limit error, set "retry_at"
warn!(?err, "health check on {} failed", rpc);
if rpc.backup {
warn!(?err, "health check on {} failed", rpc);
} else {
error!(?err, "health check on {} failed", rpc);
}
}
}