lib/good_job/cli.rb in good_job-1.3.0 vs lib/good_job/cli.rb in good_job-1.3.1
- old
+ new
@@ -43,15 +43,17 @@
type: :numeric,
banner: 'SECONDS',
desc: "Interval between polls for available jobs in seconds (env var: GOOD_JOB_POLL_INTERVAL, default: 5)"
def start
set_up_application!
+ configuration = GoodJob::Configuration.new(options)
notifier = GoodJob::Notifier.new
- configuration = GoodJob::Configuration.new(options)
+ poller = GoodJob::Poller.new(poll_interval: configuration.poll_interval)
scheduler = GoodJob::Scheduler.from_configuration(configuration)
notifier.recipients << [scheduler, :create_thread]
+ poller.recipients << [scheduler, :create_thread]
@stop_good_job_executable = false
%w[INT TERM].each do |signal|
trap(signal) { @stop_good_job_executable = true }
end
@@ -60,9 +62,10 @@
sleep 0.1
break if @stop_good_job_executable || scheduler.shutdown? || notifier.shutdown?
end
notifier.shutdown
+ poller.shutdown
scheduler.shutdown
end
default_task :start