lib/good_job/cli.rb in good_job-3.12.5 vs lib/good_job/cli.rb in good_job-3.12.6

- old
+ new

@@ -93,18 +93,13 @@ GoodJob.configuration.options.merge!(options.symbolize_keys) configuration = GoodJob.configuration Daemon.new(pidfile: configuration.pidfile).daemonize if configuration.daemonize? - notifier = GoodJob::Notifier.new(enable_listening: GoodJob.configuration.enable_listen_notify) - poller = GoodJob::Poller.new(poll_interval: configuration.poll_interval) - scheduler = GoodJob::Scheduler.from_configuration(configuration, warm_cache_on_initialize: true) - notifier.recipients << [scheduler, :create_thread] - poller.recipients << [scheduler, :create_thread] + capsule = GoodJob::Capsule.new + capsule.start - cron_manager = GoodJob::CronManager.new(configuration.cron_entries, start_on_initialize: true) if configuration.enable_cron? - if configuration.probe_port probe_server = GoodJob::ProbeServer.new(port: configuration.probe_port) probe_server.start end @@ -113,14 +108,13 @@ trap(signal) { @stop_good_job_executable = true } end Kernel.loop do sleep 0.1 - break if @stop_good_job_executable || scheduler.shutdown? || notifier.shutdown? + break if @stop_good_job_executable || capsule.shutdown? end - executors = [notifier, poller, cron_manager, scheduler].compact - GoodJob._shutdown_all(executors, timeout: configuration.shutdown_timeout) + capsule.shutdown(timeout: configuration.shutdown_timeout) probe_server&.stop end default_task :start