chore: log failed tip fetch only after 20 tries (#7850)

This commit is contained in:
Dan Cline
2024-04-24 17:00:25 -04:00
committed by GitHub
parent a22cf2189f
commit 766e77a811

View File

@ -425,6 +425,7 @@ impl NodeConfig {
Client: HeadersClient,
{
info!(target: "reth::cli", ?tip, "Fetching tip block from the network.");
let mut fetch_failures = 0;
loop {
match get_single_header(&client, tip).await {
Ok(tip_header) => {
@ -432,7 +433,10 @@ impl NodeConfig {
return Ok(tip_header);
}
Err(error) => {
error!(target: "reth::cli", %error, "Failed to fetch the tip. Retrying...");
fetch_failures += 1;
if fetch_failures % 20 == 0 {
error!(target: "reth::cli", ?fetch_failures, %error, "Failed to fetch the tip. Retrying...");
}
}
}
}