Skip to content

Retry HTTP 429 Errors#578

Merged
f2prateek merged 1 commit intomasterfrom
retry-429
May 17, 2018
Merged

Retry HTTP 429 Errors#578
f2prateek merged 1 commit intomasterfrom
retry-429

Conversation

@f2prateek
Copy link
Copy Markdown
Contributor

As per the library guidelines, our retry policy should be:

  1. Retry network errors (socket timed out, etc.)
  2. Retry server errors (HTTP 5xx)
  3. Do not retry client errors (HTTP 4xx)
  4. Except HTTP 429.

We weren't handling the HTTP 429 case correctly. This PR updates the retry logic to correctly handle this case. This shouldn't matter too much in practice immediately because we don't serve this status code currently, but is good to have to future proof the library.

Ref: https://paper.dropbox.com/doc/Analytics-library-guidelines-2trBhLKQD4Soz4VatvuGR#:uid=189560039280582553736180&h2=Handling-Network-Errors

Ref: https://segment.atlassian.net/browse/LIB-379

As per the library guidelines, our retry policy should be:

1. Retry network errors (socket timed out, etc.)
2. Retry server errors (HTTP 5xx)
3. Do not retry client errors (HTTP 4xx)
  1. Except HTTP 429.

We weren't handling the HTTP 429 case correctly. This PR updates the retry logic to correctly handle this case. This shouldn't matter too much in practice immediately because we don't serve this status code currently, but is good to have to future proof the library.
@f2prateek
Copy link
Copy Markdown
Contributor Author

This also updates some older tests which weren't verifying that the test attempts to make an HTTP request.

@f2prateek f2prateek merged commit b6c1983 into master May 17, 2018
@f2prateek f2prateek deleted the retry-429 branch May 17, 2018 22:25
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.

1 participant