-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🌱Use context.WithTimeoutCause and context.WithCancelCause for better readability #11705
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
On looking into the occurrences of |
/cc @sbueringer |
Definitely fine to not change anything in test files |
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.
Thx for opening this PR. I think it's better to express "why the timeout/context expired" vs expressiong what we were doing when it expired. The latter is usually handled when we wrap the error
Not sure if you pushed your latest commit :) I didn't see any changes to context.Cancel in non-test files. (there are also a few more cases of context.WithTimeout in non-test files, but you might have been looking for initial feedback before addressing these :)) |
That's right, I will address the review the comments and cover the remaining occurrences in non test files as well. |
@Amulyam24 Can you please rebase? Thank you! :) |
Hi @sbueringer, rebased the PR. PTAL, Thanks! |
Please take a look at the linter findings: https://github.com/kubernetes-sigs/cluster-api/actions/runs/13054341109?pr=11705 The tests have probably been broken due to some changes related to ctx (but I can look for that during review) |
/retest |
@sbueringer, the lint and failing tests are fixed. Minor change was missed during to rebase. |
Thank you very much! /lgtm |
LGTM label has been added. Git tree hash: 99923fcce58d5666ecce447ff9ffb4c0057461ec
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer 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 |
/retest |
What this PR does / why we need it:
This PR replaces
context.WithTimeoutCause
andcontext.WithCancelCause
instead ofcontext.Timeout
andcontext.WithCancel
for better readability of issues when the standardcontext deadline exceeded
error is emitted.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #11280