-
Notifications
You must be signed in to change notification settings - Fork 69
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
Report context cancel cause in DoBatchWithOptions instead of ctx.Err(). #577
Conversation
a797db2
to
a6583a1
Compare
I'm good on this change. It seems straightforward and propagates more info (if available) back to the caller. The ring is very specialized and highly critical code. Let me try to summon an expert to confirm this won't do anything unexpected. |
a6583a1
to
a665d52
Compare
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.
Cannot this introduce a subtle bugs in code that already uses cancelation with cause, but calls to DoBatchWithOptions
do expect standard context errors to be returned?
WDYT about adding an option to DoBatchOptions
struct to enable return of context.Cause(ctx)
errors instead?
Closes grafana#576 Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
a665d52
to
878e835
Compare
I think it is very unlikely, but definitely possible. I don't have a good idea right now why one would do that.
It is a viable option. It adds some complexity and makes it less likely that callers of If you prefer the safer but more complex option, I can adapt the PR accordingly. |
I can imagine this scenario very easily, with different layers having different expectations. I don't see a good way to find this in practice, other than just making the change and testing it.
We could also make the flag to be opt-out -- enable the new behaviour by default, but provide way to disable it in case it proves troublesome. (It is a possibly breaking change after all). I would ask @colega for his opinion too, since he introduced context checks into this code. |
Dismissing my review b/c there are some obvious concerns here and I don't want this accidentally merged.
I like the idea. It would be a good compromise between moving forward and reducing risk. |
As far as I understand context cancellations with cause, this LGTM. I think adding the option would only make it harder to reason about in the future (as we all know nobody would remove that option). |
The |
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.
Thank you!
What this PR does:
Report context cancel cause in
DoBatchWithOptions
instead ofctx.Err()
.Which issue(s) this PR fixes:
Closes #576
Checklist
CHANGELOG.md
updated - the order ox entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]