Skip to content

Commit 86dd1c9

Browse files
PR feedback
1 parent c26c9cd commit 86dd1c9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/service/middleware/retry.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ fn header_as_i64(headers: &HeaderMap<HeaderValue>, header: impl AsHeaderName) ->
1818
pub enum RetryConfig {
1919
None,
2020
Simple(usize),
21-
/// Retry .0 times if the status is a 5XX or if the status code is in the list of statuses
21+
/// Retry [`self.0`] times if the status is a 5XX or if the status code is in the list of statuses
2222
SimpleWithStatuses(usize, &'static [u16]),
23-
/// Handle github's retry headers, up to .0 times.
23+
/// Handle github's retry headers, up to [`self.0`] times.
2424
/// Per the rate limit documentation here: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
2525
/// If we get a 429 and none of the headers are present, wait 60 seconds.
2626
/// If we get a 403, and neither of those headers are present, do not retry.
@@ -93,9 +93,10 @@ impl<B> Policy<Request<OctoBody>, Response<B>, Error> for RetryConfig {
9393
let response = result.ok()?;
9494
let new_retries = *max_retries - 1;
9595

96-
if response.status() == http::StatusCode::TOO_MANY_REQUESTS
97-
|| response.status() == http::StatusCode::FORBIDDEN
98-
{
96+
if matches!(
97+
response.status(),
98+
http::StatusCode::TOO_MANY_REQUESTS | http::StatusCode::FORBIDDEN
99+
) {
99100
let headers = response.headers();
100101
let wait_secs = match (
101102
header_as_u64(headers, "retry-after"),

0 commit comments

Comments
 (0)