treat serde errors as rate limits (because all of them seem to be)
This commit is contained in:
parent
042e644865
commit
264508c454
@ -204,7 +204,8 @@ impl OpenRequestHandle {
|
|||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
// we do NOT want to measure errors, so we intentionally do not record this latency now.
|
// measure successes and errors
|
||||||
|
// originally i thought we wouldn't want errors, but I think it's a more accurate number including all requests
|
||||||
let latency = start.elapsed();
|
let latency = start.elapsed();
|
||||||
|
|
||||||
// we used to fetch_sub the active_request count here, but sometimes the handle is dropped without request being called!
|
// we used to fetch_sub the active_request count here, but sometimes the handle is dropped without request being called!
|
||||||
@ -263,21 +264,26 @@ impl OpenRequestHandle {
|
|||||||
// check for "execution reverted" here
|
// check for "execution reverted" here
|
||||||
// TODO: move this info a function on ResponseErrorType
|
// TODO: move this info a function on ResponseErrorType
|
||||||
let response_type = if let ProviderError::JsonRpcClientError(err) = err {
|
let response_type = if let ProviderError::JsonRpcClientError(err) = err {
|
||||||
// JsonRpc and Application errors get rolled into the JsonRpcClientError
|
if let Some(_err) = err.as_serde_error() {
|
||||||
let msg = err.as_error_response().map(|x| x.message.clone());
|
// this seems to pretty much always be a rate limit error
|
||||||
|
ResponseTypes::RateLimit
|
||||||
|
} else if let Some(err) = err.as_error_response() {
|
||||||
|
// JsonRpc and Application errors get rolled into the JsonRpcClientError
|
||||||
|
let msg = err.message.as_str();
|
||||||
|
|
||||||
if let Some(msg) = msg {
|
|
||||||
trace!(%msg, "jsonrpc error message");
|
trace!(%msg, "jsonrpc error message");
|
||||||
|
|
||||||
if msg.starts_with("execution reverted") {
|
if msg.starts_with("execution reverted") {
|
||||||
trace!("revert from {}", self.rpc);
|
|
||||||
ResponseTypes::Revert
|
ResponseTypes::Revert
|
||||||
} else if msg.contains("limit") || msg.contains("request") {
|
} else if msg.contains("limit") || msg.contains("request") {
|
||||||
|
// TODO! THIS HAS TOO MANY FALSE POSITIVES! Theres another spot in the code that checks for things.
|
||||||
ResponseTypes::RateLimit
|
ResponseTypes::RateLimit
|
||||||
} else {
|
} else {
|
||||||
ResponseTypes::Error
|
ResponseTypes::Error
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// i don't think this is possible
|
||||||
|
warn!(?err, "unexpected error");
|
||||||
ResponseTypes::Error
|
ResponseTypes::Error
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user