-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support exponential backoff for cutover attempts #563
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
Conversation
…ithExponentialBackoff and conditionally use it
…ckoff Support exponential backoff for cutover attempts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looking very good.
We have a flag called default-retries
. I'm thinking we should respect is. Thus, the loop should not end on interval < maxInterval
but rather on numAttempts < defaultRetries
. We can cap interval
to maxInterval
and keep looping with maxInterval
.
Also, if this logic is to be used by other retry operations (as you suggest), I'd advise renaming the flags so that they do not contain the text cut-over
.
…max interval flag more generically (#2) * rename flags, obey defaultNumRetries * capitalization fixes * fix flag description typo * fix sleep algorithm
@shlomi-noach I made the updates you suggested, with one exception: I don't think we should rename the flag |
Sent to testing. |
Support exponential backoff for cutover attempts
@shlomi-noach Why was this merged into the branch |
@kurtzur ah, my mistake! Will merge to |
Merged into |
Related issue: #558
Description
This PR introduces the flags
cut-over-exponential-backoff
andcut-over-exponential-backoff-max-interval
.cut-over-exponential-backoff
is a boolean flag which, if set totrue
, spaces out cutover attempts using an exponential backoff algorithm. This flag defaults tofalse
.cut-over-exponential-backoff-max-interval
is a numeric flag which dictates the upper bound that the exponentially increasing attempt spacing should obey. This flag defaults to 64 seconds, or 8 total attempts. I enforced a minimum of 2 seconds for this value, which would correspond to 3 total attempts. I added this validation because enabling exponential backoff with fewer than 3 attempts seems both pointless and likely accidental.The exponential backoff is implemented as a separate function
retryOperationWithExponentialBackoff
. LikeretryOperation
, this function would be reusable in other parts of the project if desired.script/cibuild
returns with no formatting errors, build errors or unit test errors.