wip
This commit is contained in:
parent
a3b97fda9b
commit
74a602bc9c
@ -3,7 +3,7 @@ mod rtt_estimate;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use kanal::SendError;
|
use kanal::SendError;
|
||||||
use log::error;
|
use log::{error, info, trace};
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use tokio::time::{Duration, Instant};
|
use tokio::time::{Duration, Instant};
|
||||||
|
|
||||||
@ -70,7 +70,9 @@ impl PeakEwmaLatency {
|
|||||||
/// Should only be called from the Web3Rpc that owns it.
|
/// Should only be called from the Web3Rpc that owns it.
|
||||||
pub fn report(&self, duration: Duration) {
|
pub fn report(&self, duration: Duration) {
|
||||||
match self.request_tx.try_send(duration) {
|
match self.request_tx.try_send(duration) {
|
||||||
Ok(true) => {}
|
Ok(true) => {
|
||||||
|
trace!("success");
|
||||||
|
}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
// We don't want to block if the channel is full, just
|
// We don't want to block if the channel is full, just
|
||||||
// report the error
|
// report the error
|
||||||
@ -113,6 +115,8 @@ impl PeakEwmaLatencyTask {
|
|||||||
fn update(&mut self, rtt: Duration) {
|
fn update(&mut self, rtt: Duration) {
|
||||||
let rtt = nanos(rtt);
|
let rtt = nanos(rtt);
|
||||||
|
|
||||||
|
info!("updating rtt: {}ns", rtt);
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
self.update_at <= now,
|
self.update_at <= now,
|
||||||
|
@ -407,7 +407,11 @@ impl ConsensusFinder {
|
|||||||
{
|
{
|
||||||
Ok(parent_block) => block_to_check = parent_block,
|
Ok(parent_block) => block_to_check = parent_block,
|
||||||
Err(err) => {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ use entities::revert_log;
|
|||||||
use entities::sea_orm_active_enums::Method;
|
use entities::sea_orm_active_enums::Method;
|
||||||
use ethers::providers::ProviderError;
|
use ethers::providers::ProviderError;
|
||||||
use ethers::types::{Address, Bytes};
|
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 migration::sea_orm::{self, ActiveEnum, ActiveModelTrait};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
@ -374,6 +374,7 @@ impl OpenRequestHandle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let Some(peak_latency) = &self.rpc.peak_latency {
|
} else if let Some(peak_latency) = &self.rpc.peak_latency {
|
||||||
|
trace!("updating peak_latency: {}", latency.as_secs_f64());
|
||||||
peak_latency.report(latency);
|
peak_latency.report(latency);
|
||||||
} else {
|
} else {
|
||||||
unreachable!("peak_latency not initialized");
|
unreachable!("peak_latency not initialized");
|
||||||
|
Loading…
Reference in New Issue
Block a user