This commit is contained in:
Bryan Stitt 2023-05-12 23:20:59 -07:00
parent a3b97fda9b
commit 74a602bc9c
3 changed files with 13 additions and 4 deletions

@ -3,7 +3,7 @@ mod rtt_estimate;
use std::sync::Arc;
use kanal::SendError;
use log::error;
use log::{error, info, trace};
use tokio::task::JoinHandle;
use tokio::time::{Duration, Instant};
@ -70,7 +70,9 @@ impl PeakEwmaLatency {
/// Should only be called from the Web3Rpc that owns it.
pub fn report(&self, duration: Duration) {
match self.request_tx.try_send(duration) {
Ok(true) => {}
Ok(true) => {
trace!("success");
}
Ok(false) => {
// We don't want to block if the channel is full, just
// report the error
@ -113,6 +115,8 @@ impl PeakEwmaLatencyTask {
fn update(&mut self, rtt: Duration) {
let rtt = nanos(rtt);
info!("updating rtt: {}ns", rtt);
let now = Instant::now();
debug_assert!(
self.update_at <= now,

@ -407,7 +407,11 @@ impl ConsensusFinder {
{
Ok(parent_block) => block_to_check = parent_block,
Err(err) => {
warn!("Problem fetching parent block of {:#?} during consensus finding: {:#?}", block_to_check, err);
warn!(
"Problem fetching parent block of {:?} during consensus finding: {:#?}",
block_to_check.hash(),
err
);
break;
}
}

@ -7,7 +7,7 @@ use entities::revert_log;
use entities::sea_orm_active_enums::Method;
use ethers::providers::ProviderError;
use ethers::types::{Address, Bytes};
use log::{debug, error, trace, warn, Level};
use log::{debug, error, info, trace, warn, Level};
use migration::sea_orm::{self, ActiveEnum, ActiveModelTrait};
use serde_json::json;
use std::fmt;
@ -374,6 +374,7 @@ impl OpenRequestHandle {
}
}
} else if let Some(peak_latency) = &self.rpc.peak_latency {
trace!("updating peak_latency: {}", latency.as_secs_f64());
peak_latency.report(latency);
} else {
unreachable!("peak_latency not initialized");