more logs

This commit is contained in:
Bryan Stitt 2023-06-28 18:44:54 -07:00
parent e8d992168c
commit d11d6c1f8a
3 changed files with 15 additions and 10 deletions

View File

@ -17,7 +17,7 @@ use std::time::Duration;
use std::{fmt::Display, sync::Arc};
use tokio::sync::broadcast;
use tokio::time::timeout;
use tracing::{debug, error};
use tracing::{debug, error, warn};
// TODO: type for Hydrated Blocks with their full transactions?
pub type ArcBlock = Arc<Block<TxHash>>;
@ -439,10 +439,11 @@ impl Web3Rpcs {
match timeout(double_block_time, block_receiver.recv_async()).await {
Ok(Ok((new_block, rpc))) => {
let rpc_name = rpc.name.clone();
let rpc_is_backup = rpc.backup;
// TODO: what timeout on this?
match timeout(
Duration::from_secs(2),
Duration::from_secs(1),
consensus_finder.process_block_from_rpc(
self,
authorization,
@ -468,10 +469,14 @@ impl Web3Rpcs {
}
}
Err(timeout) => {
error!(
"timeout while processing block from {}: {:#?}",
rpc_name, timeout
);
if rpc_is_backup {
debug!(
?timeout,
"timeout while processing block from {}", rpc_name
);
} else {
warn!(?timeout, "timeout while processing block from {}", rpc_name);
}
}
}
}

View File

@ -872,9 +872,9 @@ impl ConsensusFinder {
backup_entry.1 += rpc.soft_limit;
let parent_hash = block_to_check.parent_hash();
// TODO: i flip flop on passing rpc to this or not
match web3_rpcs
.block(authorization, parent_hash, Some(rpc), None, None)
.block(authorization, parent_hash, Some(rpc), Some(1), None)
.await
{
Ok(parent_block) => block_to_check = parent_block,

View File

@ -1038,9 +1038,9 @@ impl Web3Rpc {
if !self.backup {
let when = retry_at.duration_since(Instant::now());
warn!(
"Exhausted rate limit on {}. Retry in {}ms",
retry_ms=%when.as_millis(),
"Exhausted rate limit on {}",
self,
when.as_millis()
);
}