-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix HotRod job pool termination (#1453) #1454
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
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #1454 +/- ##
=========================================
+ Coverage 99.81% 100% +0.18%
=========================================
Files 179 165 -14
Lines 8554 7510 -1044
=========================================
- Hits 8538 7510 -1028
+ Misses 9 0 -9
+ Partials 7 0 -7
Continue to review full report at Codecov.
|
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.
Please adjust the PR title, it's not "fixing" anything that's broken, it just a different way of doing the same thing (I agree closing the channel is more idiomatic way).
@@ -49,5 +49,7 @@ func (p *Pool) Execute(job func()) { | |||
|
|||
// Stop halts all the workers | |||
func (p *Pool) Stop() { | |||
p.stop <- struct{}{} | |||
if p.stop != nil { |
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.
why is the nil check necessary?
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.
@yurishkuro sorry for the late reply,
IMHO, this is a bug. Assuming you have more than 1 worker, calling stop only stops 1 of the workers and not all, while as closing the chan stops all the workers. Please let me know if you still want me to rename the PR.
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.
good point
## Which problem is this PR solving? - Resolves part of #7261 ## Description of the changes - Working on: `examples/hotrod/pkg/pool/pool.go` (`Pool.Stop` Method) - Files identified by deadcode tool: `examples/hotrod/pkg/pool/pool.go`: - `Pool.Stop` method unreachable - When introduced: PR #40 - When fixed: PR #1454 - current state: Pool.Stop() method is never called anywhere in the codebase. Only Pool.New() and Pool.Execute() are used in production - Files to modify: `examples/hotrod/pkg/pool/pool.go` - remove Stop() method ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` Signed-off-by: Parship Chowdhury <i.am.parship@gmail.com>
Which problem is this PR solving?
Short description of the changes