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 plugin to use new shutdown stop semantics #28

Closed
wants to merge 1 commit into from

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Sep 16, 2015

decorate(event)
queue << event
end
end # client.filter
rescue LogStash::ShutdownSignal
return
rescue Twitter::Error::TooManyRequests => e
@logger.warn("Twitter too many requests error, sleeping for #{e.rate_limit.reset_in}s")
sleep(e.rate_limit.reset_in)
Copy link

Choose a reason for hiding this comment

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

It would be necessary to track this sleep, imagine the situation we're sleeping in, but aim to stop the input. This would be done easy by tracking the state and then using a thread.wakeup. You would also need to implement the stop method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isn't this true of all inputs that have the following "high-level" behavior

while !stop?
    sleep 3
    do_something()
end

Copy link

Choose a reason for hiding this comment

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

yes, and we updated them all to use now Stud.stopppable_stop from https://github.com/jordansissel/ruby-stud/blob/master/lib/stud/interval.rb#L76-L93 I recommend you update this PR to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to use stoppable sleep.

I tried doing

def stop
    Stud.stop!
end

is that not the correct way to use Stud's stop mechanism?

instead I went with a block of { stop? }

@purbon
Copy link

purbon commented Sep 16, 2015

Test pass for me, and kinda makes sense the way they are implemented 👍, just left you two small comments to figure it out and everything is fine!! good work here man!

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

talevy commented Sep 18, 2015

updated to reflect your comments, thanks!

@jsvd
Copy link
Member

jsvd commented Sep 21, 2015

LGTM

@elasticsearch-bot
Copy link

Merged sucessfully into master!

@talevy talevy closed this in c328804 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.

4 participants