-
Notifications
You must be signed in to change notification settings - Fork 4.6k
benchmark/client: add context for cancellation #8614
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8614 +/- ##
==========================================
+ Coverage 81.96% 82.04% +0.07%
==========================================
Files 415 415
Lines 40694 40694
==========================================
+ Hits 33355 33387 +32
+ Misses 5950 5946 -4
+ Partials 1389 1361 -28 🚀 New features to boost your workflow:
|
Could you please add "Type: Internal Cleanup" label? Thanks |
select { | ||
case <-bc.stop: | ||
if bc.ctx.Err() != nil { | ||
return |
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.
Can we change it to return bc.ctx.Err()
and change function unaryLoop
to return error?
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.
I believe we can, but error is happening inside a goroutine and I'm not quite sure how to implement handling. Could you suggest an approach?
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 err := benchmark.DoUnaryCall(client, reqSize, respSize); err != nil { | ||
if err := benchmark.DoUnaryCallWithContext(bc.ctx, client, reqSize, respSize); err != nil { | ||
if status.Code(err) == codes.Canceled || errors.Is(err, context.Canceled) { | ||
return |
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.
Any specific reason for not changing the return type of unaryLoop
to return ctx.Err()
?
Fixes: #8596
Added cancellation by context in benchmark/client instead of custom channel approach. Not sure about returning
ctx.Err()
(as mentioned in the original issue under point 4), so please reviewRELEASE NOTES: None