-
Notifications
You must be signed in to change notification settings - Fork 542
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
Respect context cancellation and deadlines. #671
Respect context cancellation and deadlines. #671
Conversation
The linting error reported by 0x1 << uint8(math.Ceil(float64(i/2))) I did not write it and it's orthogonal to this PR. Therefore, I would like to hear from the maintainers what to do before fixing it. |
There are two possibilities: either the context was cancelled or the deadline exceeded.
golangci-lint would have picked this up as the line itself was edited in this PR. as the fix is just removing the |
PS: The threshold cannot be longer than 1s; otherwise it is not failing the old (wrong) code.
Got it. I tried to simplify the expression further. |
LGTM, thanks! 🥳 |
Description
The backoff during retries should have checked the deadline/timeout set by context.
Has your change been tested?
Two regression tests were added, though they are not very robust. The 2s and
.5s1s thresholds to detect whether the library is honoring the deadlines are in a sense arbitrary.Types of changes
What sort of change does your code introduce/modify?
Checklist: