diff --git a/web3_proxy/src/rpcs/many.rs b/web3_proxy/src/rpcs/many.rs index 14e17ed4..6bfa5e5f 100644 --- a/web3_proxy/src/rpcs/many.rs +++ b/web3_proxy/src/rpcs/many.rs @@ -902,7 +902,11 @@ impl Web3Rpcs { let rate_limit_substrings = ["limit", "exceeded", "quota usage"]; for rate_limit_substr in rate_limit_substrings { if error_msg.contains(rate_limit_substr) { - if error_msg.contains("result on length") { + if error_msg.contains("block size") { + // TODO: this message is likely wrong, but i can't find the actual one in my terminal now + // they hit an expected limit. return the error now + return Err(error.into()); + } else if error_msg.contains("result on length") { // this error contains "limit" but is not a rate limit error // TODO: make the expected limit configurable // TODO: parse the rate_limit_substr and only continue if it is < expected limit @@ -910,10 +914,10 @@ impl Web3Rpcs { // they hit our expected limit. return the error now return Err(error.into()); } else { - // they hit a limit lower than what we expect - warn!( + // they hit a limit lower than what we expect. the server is misconfigured + error!( %error_msg, - "unexpected result limitby {}", + "unexpected result limit by {}", skip_rpcs.last().unwrap(), ); continue; diff --git a/web3_proxy/src/rpcs/one.rs b/web3_proxy/src/rpcs/one.rs index 1424db3a..1e58e97f 100644 --- a/web3_proxy/src/rpcs/one.rs +++ b/web3_proxy/src/rpcs/one.rs @@ -965,6 +965,8 @@ impl Web3Rpc { max_wait: Option, error_handler: Option, ) -> Web3ProxyResult { + // TODO: what should the default be? + // TODO: split max_wait_connect (which might wait if a rate limit is pending) and max_wait_request let max_wait_until = max_wait.map(|x| Instant::now() + x); loop { diff --git a/web3_proxy/src/rpcs/request.rs b/web3_proxy/src/rpcs/request.rs index c38a138f..921eb709 100644 --- a/web3_proxy/src/rpcs/request.rs +++ b/web3_proxy/src/rpcs/request.rs @@ -273,12 +273,6 @@ impl OpenRequestHandle { trace!("revert from {}", self.rpc); ResponseTypes::Revert } else if msg.contains("limit") || msg.contains("request") { - // TODO: too verbose - if self.rpc.backup { - trace!(%msg, "rate limit from {}", self.rpc); - } else { - warn!(%msg, "rate limit from {}", self.rpc); - } ResponseTypes::RateLimit } else { ResponseTypes::Error @@ -295,16 +289,13 @@ impl OpenRequestHandle { // TODO: how long should we actually wait? different providers have different times // TODO: if rate_limit_period_seconds is set, use that // TODO: check response headers for rate limits too - // TODO: warn if production, debug if backup - if self.rpc.backup { - debug!("unexpected rate limit on {}!", self.rpc); - } else { - warn!("unexpected rate limit on {}!", self.rpc); - } - let retry_at = Instant::now() + Duration::from_secs(1); - trace!("retry {} at: {:?}", self.rpc, retry_at); + if self.rpc.backup { + debug!(?retry_at, "rate limited on {}!", self.rpc); + } else { + warn!(?retry_at, "rate limited on {}!", self.rpc); + } hard_limit_until.send_replace(retry_at); }