lib/good_job/cli.rb in good_job-2.6.2 vs lib/good_job/cli.rb in good_job-2.7.0

- old
+ new

@@ -77,10 +77,13 @@ type: :boolean, desc: "Run as a background daemon (default: false)" method_option :pidfile, type: :string, desc: "Path to write daemonized Process ID (env var: GOOD_JOB_PIDFILE, default: tmp/pids/good_job.pid)" + method_option :probe_port, + type: :numeric, + desc: "Port for http health check (env var: GOOD_JOB_PROBE_PORT, default: nil)" def start set_up_application! configuration = GoodJob::Configuration.new(options) @@ -91,10 +94,14 @@ scheduler = GoodJob::Scheduler.from_configuration(configuration, warm_cache_on_initialize: true) notifier.recipients << [scheduler, :create_thread] poller.recipients << [scheduler, :create_thread] 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 @stop_good_job_executable = false %w[INT TERM].each do |signal| trap(signal) { @stop_good_job_executable = true } end @@ -104,9 +111,10 @@ break if @stop_good_job_executable || scheduler.shutdown? || notifier.shutdown? end executors = [notifier, poller, cron_manager, scheduler].compact GoodJob._shutdown_all(executors, timeout: configuration.shutdown_timeout) + probe_server&.stop end default_task :start # @!macro thor.desc