Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
saketh-are committed Nov 24, 2024
1 parent 51eec8c commit eb11601
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions chain/client/src/sync/state/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ impl StateSyncDownloadSourceExternal {
Err(near_chain::Error::Other("Cancelled".to_owned()))
}
result = fut => {
result.map_err(|e| {
// A download error typically indicates that the file is not available yet. At the
// start of the epoch it takes a while for dumpers to populate the external storage
// with state files. This backoff period prevents spamming requests during that time.
let deadline = clock.now() + backoff;
tokio::select! {
_ = clock.sleep_until(deadline) => {}
_ = cancellation.cancelled() => {}
match result {
Err(err) => {
// A download error typically indicates that the file is not available yet. At the
// start of the epoch it takes a while for dumpers to populate the external storage
// with state files. This backoff period prevents spamming requests during that time.
let deadline = clock.now() + backoff;
tokio::select! {
_ = clock.sleep_until(deadline) => {}
_ = cancellation.cancelled() => {}
}
increment_download_count(shard_id, typ, "external", "download_error");
Err(near_chain::Error::Other(format!("Failed to download: {}", err)))
}

increment_download_count(shard_id, typ, "external", "download_error");
near_chain::Error::Other(format!("Failed to download: {}", e))
})
Ok(res) => Ok(res)
}
}
}
}
Expand Down

0 comments on commit eb11601

Please sign in to comment.