Skip to content
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

Merged
merged 2 commits into from
Apr 17, 2019
Merged

Conversation

mfrw
Copy link
Contributor

@mfrw mfrw commented Apr 3, 2019

Which problem is this PR solving?

Short description of the changes

  • Close the stop channel instead of sending values to it.

@codecov
Copy link

codecov bot commented Apr 3, 2019

Codecov Report

Merging #1454 into master will increase coverage by 0.18%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
plugin/storage/factory.go 100% <0%> (ø) ⬆️
model/dependencies.go 100% <0%> (ø) ⬆️
cmd/collector/app/metrics.go 100% <0%> (ø) ⬆️
cmd/collector/app/grpc_handler.go 100% <0%> (ø) ⬆️
pkg/healthcheck/handler.go 100% <0%> (ø) ⬆️
cmd/collector/app/span_processor.go 100% <0%> (ø) ⬆️
cmd/collector/app/http_handler.go 100% <0%> (ø) ⬆️
cmd/collector/app/zipkin/http_handler.go 100% <0%> (ø) ⬆️
cmd/collector/app/builder/builder_flags.go 100% <0%> (ø) ⬆️
model/sort.go 100% <0%> (ø) ⬆️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f9702c4...bab6d24. Read the comment docs.

Copy link
Member

@yurishkuro yurishkuro left a 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 {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

@yurishkuro yurishkuro merged commit be6340f into jaegertracing:master Apr 17, 2019
@mfrw mfrw deleted the hotrod branch April 28, 2019 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HotRod: pool: Stop all the workers by closing the stop channel
2 participants