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(api_core): make the last retry happen at deadline #9873

Merged
merged 2 commits into from
Dec 10, 2019

Conversation

plamut
Copy link
Contributor

@plamut plamut commented Nov 21, 2019

Fixes #9872.
Towards #7831.

This PR changes the behavior of Retry objects to complete retrying at the specified deadline.

Previously, Retry objects only checked if the next sleep period started before the deadline. This means that the last retry could happen considerably later than the deadline, which can be problematic if there is, say, a future sitting on top that cannot wait that long.

PR checklist

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@plamut plamut added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. api: core labels Nov 21, 2019
@plamut plamut requested a review from busunkim96 as a code owner November 21, 2019 09:54
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 21, 2019
@plamut plamut requested a review from tswast November 21, 2019 09:54
If a deadline is set as strict, Retry will shorten the last sleep
period to end at the given deadline, and not possibly stretch beyond
it.
This commit changes Retry instances in a way that the last sleep period
is shortened so that its end matches at the given deadline. This
prevents the last sleep period to last way beyond the deadline.
@plamut plamut changed the title feat(api_core): allow setting Retry deadline as strict feat(api_core): make the last retry happen at deadline Dec 9, 2019
@plamut
Copy link
Contributor Author

plamut commented Dec 9, 2019

@tswast I made the "strict deadline" behavior non-optional, it's now the default logic of Retry instances.

@plamut plamut requested a review from tswast December 9, 2019 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: core cla: yes This human has signed the Contributor License Agreement. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Core: Make the Retry objects complete "exactly" at deadline
3 participants