Skip to content

Commit

Permalink
refactor(retry): apply review feedback
Browse files Browse the repository at this point in the history
#3216 (comment)

Co-Authored-By: Oliver Gould <[email protected]>
Signed-off-by: katelyn martin <[email protected]>
  • Loading branch information
cratelyn and olix0r committed Sep 23, 2024
1 parent a249faf commit 2305731
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions linkerd/http/retry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,11 @@ async fn send_req_with_retries(
tracing::trace!("Success on first attempt");
return result.map(|rsp| rsp.map(BoxBody::new));
}
match backup.body().is_capped() {
// The body completely fit into the retry buffer, so we can retry.
Some(false) => {}
if matches!(backup.body().is_capped(), None | Some(true)) {
// The body was either too large, or we received an early response
// before the request body was completed read. We cannot safely
// attempt to send this request again.
None | Some(true) => return result.map(|rsp| rsp.map(BoxBody::new)),
return result.map(|rsp| rsp.map(BoxBody::new));
}

// The response was retryable, so continue trying to dispatch backup
Expand Down Expand Up @@ -305,9 +303,8 @@ async fn send_req_with_retries(
tracing::debug!("Retry success");
return result.map(|rsp| rsp.map(BoxBody::new));
}
match backup.body().is_capped() {
Some(false) => {}
None | Some(true) => return result.map(|rsp| rsp.map(BoxBody::new)),
if matches!(backup.body().is_capped(), None | Some(true)) {
return result.map(|rsp| rsp.map(BoxBody::new));
}
}

Expand Down

0 comments on commit 2305731

Please sign in to comment.