Skip to content

Commit

Permalink
fix: downloader retry on DNS at startup (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devdutt Shenoi authored May 10, 2024
1 parent 29b149b commit a410693
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion uplink/src/collector/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,15 @@ impl FileDownloader {
warn!("Retrying download; Continuing to download file from: {range}");
req = req.header("Range", range);
}
let mut stream = req.send().await?.error_for_status()?.bytes_stream();
let mut stream = match req.send().await {
Ok(s) => s.error_for_status()?.bytes_stream(),
Err(e) => {
error!("Download failed: {e}");
// Retry after wait
tokio::time::sleep(Duration::from_secs(1)).await;
continue 'outer;
}
};

// Download and store to disk by streaming as chunks
while let Some(item) = stream.next().await {
Expand Down

0 comments on commit a410693

Please sign in to comment.