-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
main: signal related func better with context #2306
Conversation
Signed-off-by: arthur yang <[email protected]>
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.
Thanks for your contribution.
However, I don't see any tangible reasons for this change. It doesn't improve anything. And there are controversial opinions on using context for just sake of cancellation.
https://dave.cheney.net/2017/08/20/context-isnt-for-cancellation
Under the cmd/thanos, other go files use context.WithCancel to perform the cancel semantic(the main file as well). The purpose of the PR is to keep same style of such semantic. If you doesn't agree, I'm glad to close the PR. |
Hey @00arthur00, I have checked the usages of context patterns under Lines 493 to 519 in 601d4cf
All the others are passed along to the other APIs that requires context.Context .
Maybe we should fix that exceptional case, to be consistent. |
@kakkoyun Please see the comment. Please see: |
Hah, that's true I proposed it. I think I can agree context is nice for
consistency here. But really not a big deal I don't have a strong opinion.
Any other thoughts? (:
…On Mon, 30 Mar 2020 at 09:29, Arthur ***@***.***> wrote:
Hey @00arthur00 <https://github.com/00arthur00>, I have checked the
usages of context patterns under thanos/cmd, I could only find one which
is used solely for cancellation.
https://github.com/thanos-io/thanos/blob/601d4cf57a1e940208714b2c309f990834df958d/cmd/thanos/rule.go#L493-L519
All the others are passed along to the other APIs that requires
context.Context.
Maybe we should fix that exceptional case, to be consistent.
So I'm closing this, for now, thank you for your contribution anyway!
Maybe you would want to fix that case
@kakkoyun <https://github.com/kakkoyun> Please see the comment.
The orignal one is close(ch), but bwplotka comment to use
context.WithCancel.
Please see:
#1848 (comment)
<#1848 (comment)>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2306 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVA3O5EH3RN4IW5P2ISZADRKBJ5VANCNFSM4LSKVIFQ>
.
|
I also don't have strong opinions on it as well. I find channels simpler. |
@kakkoyun |
There's no button for me to reopen the PR. |
doesnt matter too much one way or the other. I like to use chans if the use-case is simple enough and allows for it, e.g. here. Context is nice for when we have to propagate and build more context that can be cancelled by a parent. |
Let's keep it simple then. Thanks @00arthur00 anyway for this! I think building context for propagation cases, sounds like a good rule. |
change signature of func interrupt and reload with context.