-
Notifications
You must be signed in to change notification settings - Fork 64
Deps: allow any scheduler version with plugin #132
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
Changes from 59 commits
145980b
5cc8bff
4f9e022
a043181
b6505a0
bbfe024
b3d862e
3efb809
6c104fb
0607035
b3ae84c
f88e40c
dda1a80
7cfc654
6b70eb6
6c6cd17
cc08287
9287c55
53388ac
e52b01c
ae0d99c
d6074f7
2dd8a3f
901044e
10ef111
1ac1f5e
8ba255e
4ded64e
0141c35
9ed546d
f397826
793801a
f48bc6e
4eebf47
a8dafb4
85d258b
8ae1419
3c79dcc
58d6198
8b494fc
d6f0e72
ceae70b
8726a33
d370769
f86e45c
1f1b77e
5f13700
438d017
f630b2b
18f09c9
e1af18b
9b1af8b
d108f71
d1e9320
6450158
e51ec6c
6d9df13
6cc115f
4252bcb
a38b589
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| import: | ||
| - logstash-plugins/.ci:travis/[email protected] | ||
| - logstash-plugins/.ci:travis/[email protected] | ||
|
|
||
| env: | ||
| jobs: # test with old scheduler version (3.0 was locked in LS 7.x) | ||
| - ELASTIC_STACK_VERSION=7.x RUFUS_SCHEDULER_VERSION=3.0.9 LOG_LEVEL=info | ||
| - ELASTIC_STACK_VERSION=6.x RUFUS_SCHEDULER_VERSION=3.0.9 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,9 +55,12 @@ def register | |
| setup_requests! | ||
| end | ||
|
|
||
| # @overload | ||
| def stop | ||
| Stud.stop!(@interval_thread) if @interval_thread | ||
| @scheduler.stop if @scheduler | ||
| if @scheduler && @scheduler.thread && @scheduler.thread.status | ||
| @scheduler.shutdown # on newer Rufus (3.8) this joins on the scheduler thread | ||
| end | ||
| # TODO implement client.close as we as releasing it's pooled resources! | ||
| end | ||
|
|
||
| private | ||
|
|
@@ -163,16 +166,15 @@ def setup_schedule(queue) | |
| #schedule hash must contain exactly one of the allowed keys | ||
| msg_invalid_schedule = "Invalid config. schedule hash must contain " + | ||
| "exactly one of the following keys - cron, at, every or in" | ||
| raise Logstash::ConfigurationError, msg_invalid_schedule if @schedule.keys.length !=1 | ||
| raise Logstash::ConfigurationError, msg_invalid_schedule if @schedule.keys.length != 1 | ||
| schedule_type = @schedule.keys.first | ||
| schedule_value = @schedule[schedule_type] | ||
| raise LogStash::ConfigurationError, msg_invalid_schedule unless Schedule_types.include?(schedule_type) | ||
|
|
||
| @scheduler = Rufus::Scheduler.new(:max_work_threads => 1) | ||
| #as of v3.0.9, :first_in => :now doesn't work. Use the following workaround instead | ||
| opts = schedule_type == "every" ? { :first_in => 0.01 } : {} | ||
| @scheduler.send(schedule_type, schedule_value, opts) { run_once(queue) } | ||
| @scheduler.join | ||
| @scheduler.thread.join # due newer rufus (3.8) doing a blocking operation on scheduler.join | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in rufus 3.0.9 |
||
| end | ||
|
|
||
| def run_once(queue) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| Gem::Specification.new do |s| | ||
| s.name = 'logstash-input-http_poller' | ||
| s.version = '5.2.0' | ||
| s.version = '5.2.1' | ||
| s.licenses = ['Apache License (2.0)'] | ||
| s.summary = "Decodes the output of an HTTP API into events" | ||
| s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program" | ||
|
|
@@ -21,8 +21,7 @@ Gem::Specification.new do |s| | |
| s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99" | ||
| s.add_runtime_dependency 'logstash-codec-plain' | ||
| s.add_runtime_dependency "logstash-mixin-http_client", ">= 7.1.0" | ||
| s.add_runtime_dependency 'stud', "~> 0.0.22" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| s.add_runtime_dependency 'rufus-scheduler', "~>3.0.9" | ||
| s.add_runtime_dependency 'rufus-scheduler', ">= 3.0.9" | ||
| s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.3' | ||
| s.add_runtime_dependency 'logstash-mixin-event_support', '~> 1.0', '>= 1.0.1' | ||
| s.add_runtime_dependency 'logstash-mixin-validator_support', '~> 1.0' | ||
|
|
||
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've a doubt on this, if in the
.travis.ymlandGemfilewe pin to Rufus3.0.9because LS 7.x pins that version, is this code7.xproof?Do this change behaves the same way also with Rufus
3.0.9?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.
the missing
client.closeis yet another completely separate issue (basically a plugin leak on reload) - stumbled upon it while trying to investigate the CI failure - please ignore the TODO for now if it's confusing.it's proof that tests run (on CI) against latest rufus-scheduler as well as 3.0.9. LS 7.x for now used 3.0.9 but in theory (when the plugin unpinning from elastic/logstash#12931 is complete) with the right scenario of multpile
bin/logstash-plugin update ...the lock could be released and rufus could be updated.previous version had
@scheduler.shutdown if @scheduler, in theory this could still fail if the thread did not start or the thread died - in those cases we can not trigger a "safe"scheduler.shutdown. but this isn't smt we're seeing and I can revert the code to be the same as before if you have doubts (that change isn't that important atm).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 fine with this, thanks for clarification.