-
Notifications
You must be signed in to change notification settings - Fork 655
Add context to long running operations #774
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
/assign @mmiranda96 |
/assign @vteratipally |
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.
A couple of comments.
|
||
if err := npdMain(npdo, termCh); err != nil { | ||
ctx, cancelFunc := context.WithCancel(context.Background()) | ||
cancelFunc() |
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 you call cancelHere
, ctx
will not be valid when it reaches npdMain()
. Maybe you meant to write defer cancelFunc()
?
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.
fixed the code. Thanks!
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 turned out that the original code will put error into channel to simulate timeout. And will cal cancel function to do the same thing.
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.
@vteratipally Could you please take a look?
@@ -25,7 +26,7 @@ import ( | |||
"k8s.io/node-problem-detector/pkg/types" | |||
problemutil "k8s.io/node-problem-detector/pkg/util" | |||
|
|||
"k8s.io/api/core/v1" | |||
v1 "k8s.io/api/core/v1" |
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.
No need for this change.
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.
the change is reverted. Thanks!
971908c
to
0232b69
Compare
Thanks for the change! |
0232b69
to
2e6aef3
Compare
/retest |
1 similar comment
/retest |
Looks like |
Same as |
@@ -79,13 +79,11 @@ func (ne *nullExporter) ExportProblems(*types.Status) { | |||
|
|||
func TestNPDMain(t *testing.T) { | |||
npdo, cleanup := setupNPD(t) | |||
defer cleanup() | |||
cleanup() |
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.
Missing a defer here.
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.
fixed.Thanks!
/retest |
e2e-node and e2e-test jobs should pass now. /retest |
/retest |
2e6aef3
to
471ab88
Compare
/retest |
2 similar comments
/retest |
/retest |
/test pull-npd-e2e-node |
Issue has been fixed, this should pass now. /retest-required |
@vteratipally could you help me approve this PR? Thanks! |
@vteratipally Could you please take a look? Thanks! |
@mmiranda96 @vteratipally Could you please take a look? Thanks! |
Apologies for the delay. /lgtm |
/assign @vteratipally |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MartinForReal, mmiranda96, vteratipally 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 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MartinForReal, mmiranda96, vteratipally 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 |
/test pull-npd-e2e-node |
Add context to long running operations
part of #771