Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk: retry all requests which previous response was a plain 429 without an errcode #3606

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jun 25, 2024

This can happen if there's a load-balancer or any modification of the response by a reverse proxy (e.g. rewrite 5XX errors into 429, to not let a reverse proxy mark the upstream server as being down, as Cloudflare seems to do).

As a result, such requests will be retried in multiple places, including when sending something with the send queue. Also, the send queue will mark these errors as recoverable instead of unrecoverable.

No test, because the change really is trivial and a regression test didn't seem worth it, for once.

Part of #3361.

…ut an errcode

This can happen if there's a load-balancer or any modification of the
response by a reverse proxy (e.g. rewrite 5XX errors into 429, to not
let a reverse proxy mark the upstream server as being down, as
Cloudflare seems to do).

As a result, such requests will be retried in multiple places, including
when sending something with the send queue. Also, the send queue will
mark these errors as recoverable instead of unrecoverable.

No test, because the change really is trivial and a regression test
didn't seem worth it, for once.
@bnjbvr bnjbvr requested a review from a team as a code owner June 25, 2024 11:00
@bnjbvr bnjbvr requested review from Hywan, a team and poljar and removed request for a team and Hywan June 25, 2024 11:00
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.87%. Comparing base (0701c7d) to head (5912b60).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3606      +/-   ##
==========================================
+ Coverage   83.85%   83.87%   +0.01%     
==========================================
  Files         254      254              
  Lines       26319    26319              
==========================================
+ Hits        22069    22074       +5     
+ Misses       4250     4245       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

};

if let Some(status_code) = status_code {
if status_code.is_server_error() {
// If the status code is 429, this is requesting a retry in HTTP, without the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDN tells us that the 429 might contain a retry-after value in the HTTP header1, are we sure that we don't want to attempt to fish that out of the headers?

Footnotes

  1. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point we're operating from the HttpError, which contains only the status code and response body, so no more headers unfortunately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, I had trouble with this for the QR login as well. We probably should do something about this, one of these days... 🥲

@bnjbvr bnjbvr merged commit 4d6ee63 into main Jun 25, 2024
38 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/retry-all-the-429s branch June 25, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants