Skip to content

Commit

Permalink
feat(proguard): Retry upload-proguard on 507 status (#2141)
Browse files Browse the repository at this point in the history
Closes #2140
  • Loading branch information
szokeasaurusrex committed Sep 4, 2024
1 parent 288382f commit 00062a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/errors/api_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub(in crate::api) enum ApiErrorKind {
"DSN missing. Please set the `SENTRY_DSN` environment variable to your project's DSN."
)]
DsnMissing,
#[error("Error preparing request")]
ErrorPreparingRequest,
}

impl fmt::Display for ApiError {
Expand Down
9 changes: 9 additions & 0 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,15 @@ impl<'a> RegionSpecificApi<'a> {
form.part("file").file(file).add()?;
self.request(Method::Post, &path)?
.with_form_data(form)?
.with_retry(
self.api.api.config.get_max_retry_count().map_err(|e| {
ApiError::with_source(
ApiErrorKind::ErrorPreparingRequest,
e.context("Could not parse retry count"),
)
})?,
&[http::HTTP_STATUS_507_INSUFFICIENT_STORAGE],
)?
.progress_bar_mode(ProgressBarMode::Request)?
.send()?
.convert()
Expand Down
1 change: 1 addition & 0 deletions src/utils/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use regex::Regex;
pub const HTTP_STATUS_502_BAD_GATEWAY: u32 = 502;
pub const HTTP_STATUS_503_SERVICE_UNAVAILABLE: u32 = 503;
pub const HTTP_STATUS_504_GATEWAY_TIMEOUT: u32 = 504;
pub const HTTP_STATUS_507_INSUFFICIENT_STORAGE: u32 = 507;

lazy_static! {
static ref LINK_TOKEN_RE: Regex = Regex::new(
Expand Down

0 comments on commit 00062a6

Please sign in to comment.