-
Notifications
You must be signed in to change notification settings - Fork 40.7k
feat: improve the backoff calculation to O(1) #131714
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
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/hold (not to merge the pr without the approver's approval |
67ed032
to
5661fac
Compare
5661fac
to
5140786
Compare
/retest |
} | ||
duration += duration | ||
shift := podInfo.Attempts - 1 | ||
if bq.podInitialBackoff > bq.podMaxBackoff>>shift { |
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.
if bq.podInitialBackoff > bq.podMaxBackoff>>shift { | |
if bq.podInitialBackoff > bq.podMaxBackoff >> shift { |
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.
gofmt doesn't allow that format.
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.
I'm curious why they format >>
to be A>>B
, while do <<
to be A << B
(like L246) though.
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.
It's to emphasize precedence of operators. In bq.podInitialBackoff > bq.podMaxBackoff>>shift
it shows that >>
will be executed before >
. Similarly, it's a*b + c
, but a * b
. So, gofmt puts spaces between operators, but for the most important one it removes the spaces (if there are multiple ops).
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.
I see, interesting
/approve Awesome, just formatting comment |
Great improvement! /lgtm |
LGTM label has been added. Git tree hash: 092f7bf6a1786a9af128039e9c9d1febbe3b46d2
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dom4ha, macsko, sanposhiho The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/unhold |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Currently, we're calculating the backoff time with O(attempt), and this PR improves it to O(1).
before
after
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: