ethereum_adapter: Improve log message
Also realize it's correct to have step 0,
we always increase the start and advance by a block.
@@ -193,7 +193,7 @@ where
to: u64,
log_filter: EthereumLogFilter,
) -> impl Future<Item = Vec<Log>, Error = Error> {
- // Code returned by Infura if a requests returns too many logs.
+ // Code returned by Infura if a request returns too many logs.
// web3 doesn't seem to offer a better way of checking the error code.
const TOO_MANY_LOGS_FINGERPRINT: &str = "ServerError(-32005)";
@@ -273,14 +273,13 @@ where
.filter(move |log| log_filter.matches(log))
.collect::<Vec<Log>>()
})
- .then(move |res| {
- match res {
+ .then(move |res| match res {
Err(e) => {
let string_err = e.to_string();
- // web3 doesn't seem to offer a better way of inspecting the error code.
if string_err.contains(TOO_MANY_LOGS_FINGERPRINT) {
- let new_step = (step / 10).max(1);
- debug!(logger, "Reducing log step"; "new_step" => new_step);
+ let new_step = step / 10;
+ debug!(logger, "Reducing block range size to scan for events";
+ "new_size" => new_step + 1);
Ok((vec![], (start, new_step)))
} else {
warn!(logger, "Unexpected RPC error"; "error" => &string_err);
@@ -288,7 +287,6 @@ where
}
}
Ok(logs) => Ok((logs, (end + 1, step))),
- }
}),
)
})
