-
Notifications
You must be signed in to change notification settings - Fork 120
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
update to new shutdown semantics #42
Conversation
b008d28
to
b5cc96d
Compare
if @consumer_group.running? | ||
@consumer_group.shutdown | ||
end | ||
stop | ||
sleep(Float(@consumer_restart_sleep_ms) * 1 / 1000) |
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'm wondering what happen here, you added the stop call, but then after it just go into an sleep? would it be possible the thread is waiting here? ... if so, I think it would be necessary to keep track of this so the stop call is able to wakeup the thread from the sleep. What do you think?
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.
ah, you're right. I shouldn't call stop here, it should be left alone
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.
This sleep should also be updated to use Stud.stoppable_sleep
https://github.com/jordansissel/ruby-stud/blob/master/lib/stud/interval.rb#L76-L93
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.
switched to using it
@talevy leave you two small comments to understand a bit more the context of your changes. Let me know what do you think. |
005c477
to
b76e1fe
Compare
updated to reflect your comments, thanks! |
b76e1fe
to
1948475
Compare
LGTM |
end | ||
sleep(Float(@consumer_restart_sleep_ms) * 1 / 1000) | ||
retry | ||
Stud.stoppable_sleep(Float(@consumer_restart_sleep_ms) * 1 / 1000) { stop? } |
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.
Float * 1 / 1000 ?
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.
iono, I didn't want to edit this. looks like @consumer_restart_sleep_ms
is just a number
so this forces it to be a float for more precision.
LGTM |
Merged sucessfully into master! |
Fixes #41.
This depends on elastic/logstash#3895