lib/logstash/inputs/jdbc.rb in logstash-integration-jdbc-5.2.3 vs lib/logstash/inputs/jdbc.rb in logstash-integration-jdbc-5.2.4
- old
+ new
@@ -293,22 +293,11 @@
def run(queue)
load_driver
if @schedule
# input thread (Java) name example "[my-oracle]<jdbc"
- @scheduler = LogStash::PluginMixins::Jdbc::Scheduler.new(
- :max_work_threads => 1,
- :thread_name => "[#{id}]<jdbc__scheduler",
- # amount the scheduler thread sleeps between checking whether jobs
- # should trigger, default is 0.3 which is a bit too often ...
- # in theory the cron expression '* * * * * *' supports running jobs
- # every second but this is very rare, we could potentially go higher
- :frequency => 1.0,
- )
- @scheduler.schedule_cron @schedule do
- execute_query(queue)
- end
-
+ @scheduler = LogStash::PluginMixins::Jdbc::Scheduler.
+ start_cron_scheduler(@schedule, thread_name: "[#{id}]<jdbc__scheduler") { execute_query(queue) }
@scheduler.join
else
execute_query(queue)
end
end # def run