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

Add 429 status code as default to the RetryInterceptor #108

Open
UDarya opened this issue Jun 7, 2019 · 2 comments
Open

Add 429 status code as default to the RetryInterceptor #108

UDarya opened this issue Jun 7, 2019 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@UDarya
Copy link

UDarya commented Jun 7, 2019

No description provided.

@rybalkinsd rybalkinsd added enhancement New feature or request good first issue Good for newcomers labels Jun 7, 2019
@doyaaaaaken
Copy link
Contributor

Hi, I tried to work on this. And I have one question.

Which does this issue mean?

  1. When we get 429 response from external service, we should regard it as error and retry (or stop is better?) to request.
  2. When we reach to max retry attempt's count, we should handle this response as 429 status code. (Even if the response code is not 429)

If the meaning is 1, should we simply add 429 on errorStatuses at below code?

private val errorStatuses: List<Int> = listOf(503, 504)

If the meaning is 2, I guess we could not rewrite response code because Response.code is final int field.
(And also I think we shouldn't rewrite status code inside kohttp library. It's out of developer's expectation.)

@rybalkinsd
Copy link
Owner

Hey @doyaaaaaken . Let me give some thoughts.

Please, refer https://httpstatuses.com/429

As for no, we're retrying requests with delay based on invocationTimeout and ratio.
Getting 429 it is possible to retry using slightly different technique:
429 response MAY have a Retry-After: xxx header.
We can use this number (xxx) as a time before next retry.

Also, it m/b a good idea to introduce maxDelayTime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants