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

Fixed a bug when Retry-After is 0, it should use min wait time. #170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

evanchaoli
Copy link

@evanchaoli evanchaoli commented Jul 12, 2022

In my test, I set rate limit block_interval=5 rate=1, then the first response had Retry-After: 4 and the second response had Retry-After: 0, so that the second retry still failed.

When server responds Retry-After: 0, tests prove that immediate retry will fail also. Thus I think in that case MinWaitTime should be used.

The other approach I was thinking is to always return Retry-After + 1. When rate is 1, that should work better. As I my test case rate limit set to block_interval=5 rate=1, when hit rate limit, first 429 response will have Retry-After: 4, after 4 seconds, retry will hit 429 again with Retry-After: 0, then if retry immediately, if will hit 429 again. Thus if backoff is Retry-After + 1, that should work better.

But if block_interval=1, if we do Retry-After + 1, then retry interval will always be 1 second, which sounds not good, thus I chose the current approach I implemented in this PR.

@hashicorp-cla
Copy link

hashicorp-cla commented Jul 12, 2022

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants