-
Notifications
You must be signed in to change notification settings - Fork 128
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
Support canceling remote commands via context. (#1) #128
Conversation
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.
Looks good to me,
Thanks for your contribution !
close(command.done) | ||
return | ||
case <-ctxDone: |
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.
you can write:
case <-ctx.Done():
...
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.
This is an optimization. We don't exit the loop here, so this would fire every iteration through the loop. With the code as it is, it only fires a single time, then we set ctxDone
to nil
and Close()
the command.
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.
Ok, now it really does what I intended it to do after I pulled the definition of ctxDone
out of the loop.
Would you mind adding a section in the README to add minimal documentation regarding the option of passing a |
Run linter and fix linter issues.
Hello Brice, did you have something different in mind? Anything missing? Thanks... |
Hi, sorry for my lack of answers, I was abroad with limited Internet access. |
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.
LGTM 🍾
Merge pull request masterzen#128 from kgadams/master
This solves the issue #125.