-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix HotRod job pool termination (#1453) #1454
Conversation
Signed-off-by: Muhammad Falak R Wani <[email protected]>
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?
Short description of the changes