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

feat(rate-limiting) add support for Retry-After header on 429 response #5329

Merged
merged 2 commits into from Dec 17, 2019

Conversation

bungle
Copy link
Member

@bungle bungle commented Dec 12, 2019

Summary

This have been previously proposed with #3451 and #2735. This PR tries only to add Retry-After header, so it is not as complete as #3451, but it may be easier to get these in as parts.

Thank you @grahamar and @ioggstream for all the previous efforts.

Details

The Retry-After is in seconds. If there is more than one Limit configured and more than one limit has exceeded the Retry-After will contain the biggest number (in seconds). E.g. if minute limit is exceeded and hour limit is exceeded it probably means that Retry-After will tell you when the hour limit is released assuming that the minute limit will be released earlier.

The PR is also turning on most of the unit test suite on rate-limiting.

@bungle bungle force-pushed the feat/rate-limiting-retry-after branch from 6323c4e to 91ca1fb Compare December 13, 2019 21:31
@hishamhm hishamhm added this to the 2.0.0 milestone Dec 13, 2019
@bungle bungle force-pushed the feat/rate-limiting-retry-after branch from 91ca1fb to ec9d3dc Compare December 16, 2019 23:33
### Summary

This have been previously proposed with #3451 and #2735. This PR tries
only to add `Retry-After` header, so it is not as complete as #3451,
but it may be easier to get these in as parts.

Thank you @grahamar and @ioggstream for all the previous efforts.

### Details

The `Retry-After` is in `seconds`. If there is more than one `Limit`
configured and more than one limit has exceeded the `Retry-After` will
contain the biggest number (in seconds). E.g. if minute limit is
exceeded and hour limit is exceeded it probably means that `Retry-After`
will tell you when the hour limit is released assuming that the minute
limit will be released earlier.

The PR is also turning on most of the `unit test` suite on
`rate-limiting`.
@bungle bungle force-pushed the feat/rate-limiting-retry-after branch from ec9d3dc to b70a87e Compare December 17, 2019 09:44
This performs the test up to two times (and no more than two).
We are **not** retrying to "give it another shot" in case of a flaky test.
The reason why we allow for a single retry in this test suite is because
tests are dependent on the value of the current minute. If the minute
flips during the test (i.e. going from 03:43:59 to 03:44:00), the result
will fail. Since each test takes less than a minute to run, running it
a second time right after that failure ensures that another flip will
not occur. If the second execution failed as well, this means that there
was an actual problem detected by the test.
@hishamhm hishamhm merged commit f401515 into next Dec 17, 2019
@bungle bungle deleted the feat/rate-limiting-retry-after branch December 19, 2019 13:59
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.

None yet

2 participants