Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: continuous retry till timeout #294

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions uplink/src/collector/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ impl FileDownloader {
// Retry mechanism tries atleast 3 times before returning a download error
async fn retry_thrice(&mut self, url: &str, mut download: DownloadState) -> Result<(), Error> {
let mut req = self.client.get(url).send();
for _ in 0..3 {
loop {
match self.download(req, &mut download).await {
Ok(_) => break,
Err(Error::Reqwest(e)) => error!("Download failed: {e}"),
Err(e) => return Err(e),
}
tokio::time::sleep(Duration::from_secs(30)).await;
tokio::time::sleep(Duration::from_secs(1)).await;

let range = download.retry_range();
warn!("Retrying download; Continuing to download file from: {range}");
Expand Down
Loading