summaryrefslogtreecommitdiff
path: root/cli/http_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/http_util.rs')
-rw-r--r--cli/http_util.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/http_util.rs b/cli/http_util.rs
index cf244c525..9c9ae9e41 100644
--- a/cli/http_util.rs
+++ b/cli/http_util.rs
@@ -470,15 +470,23 @@ impl HttpClient {
}
}
- pub async fn download_with_progress(
+ pub async fn download_with_progress_and_retries(
&self,
url: Url,
maybe_header: Option<(HeaderName, HeaderValue)>,
progress_guard: &UpdateGuard,
) -> Result<Option<Vec<u8>>, DownloadError> {
- self
- .download_inner(url, maybe_header, Some(progress_guard))
- .await
+ crate::util::retry::retry(
+ || {
+ self.download_inner(
+ url.clone(),
+ maybe_header.clone(),
+ Some(progress_guard),
+ )
+ },
+ |e| matches!(e, DownloadError::BadResponse(_) | DownloadError::Fetch(_)),
+ )
+ .await
}
pub async fn get_redirected_url(