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

update to new shutdown semantics #42

Closed
wants to merge 1 commit into from

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Sep 15, 2015

Fixes #41.

This depends on elastic/logstash#3895

if @consumer_group.running?
@consumer_group.shutdown
end
stop
sleep(Float(@consumer_restart_sleep_ms) * 1 / 1000)
Copy link

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?

Copy link
Contributor Author

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

Copy link

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switched to using it

@purbon purbon self-assigned this Sep 16, 2015
@purbon
Copy link

purbon commented Sep 16, 2015

@talevy leave you two small comments to understand a bit more the context of your changes. Let me know what do you think.

@talevy talevy force-pushed the new_shutdown branch 2 times, most recently from 005c477 to b76e1fe Compare September 18, 2015 23:27
@talevy
Copy link
Contributor Author

talevy commented Sep 18, 2015

updated to reflect your comments, thanks!

@purbon
Copy link

purbon commented Sep 21, 2015

LGTM

end
sleep(Float(@consumer_restart_sleep_ms) * 1 / 1000)
retry
Stud.stoppable_sleep(Float(@consumer_restart_sleep_ms) * 1 / 1000) { stop? }
Copy link
Member

Choose a reason for hiding this comment

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

Float * 1 / 1000 ?

Copy link
Contributor Author

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.

@suyograo
Copy link
Contributor

LGTM

@elasticsearch-bot
Copy link

Merged sucessfully into master!

@talevy talevy closed this in 5d69963 Sep 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants