From d11d6c1f8a28d6ac786fcebd6a53f23878dfb7b1 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Wed, 28 Jun 2023 18:44:54 -0700 Subject: [PATCH] more logs --- web3_proxy/src/rpcs/blockchain.rs | 17 +++++++++++------ web3_proxy/src/rpcs/consensus.rs | 4 ++-- web3_proxy/src/rpcs/one.rs | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/web3_proxy/src/rpcs/blockchain.rs b/web3_proxy/src/rpcs/blockchain.rs index bffce3b8..8ee308d6 100644 --- a/web3_proxy/src/rpcs/blockchain.rs +++ b/web3_proxy/src/rpcs/blockchain.rs @@ -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>; @@ -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); + } } } } diff --git a/web3_proxy/src/rpcs/consensus.rs b/web3_proxy/src/rpcs/consensus.rs index 7b6d5350..0e0d53d0 100644 --- a/web3_proxy/src/rpcs/consensus.rs +++ b/web3_proxy/src/rpcs/consensus.rs @@ -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, diff --git a/web3_proxy/src/rpcs/one.rs b/web3_proxy/src/rpcs/one.rs index 6f79c00c..d5804042 100644 --- a/web3_proxy/src/rpcs/one.rs +++ b/web3_proxy/src/rpcs/one.rs @@ -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() ); }