lib/good_job/configuration.rb in good_job-3.10.1 vs lib/good_job/configuration.rb in good_job-3.11.0

- old
+ new

@@ -24,10 +24,12 @@ DEFAULT_CLEANUP_INTERVAL_SECONDS = 10.minutes.to_i # Default to always wait for jobs to finish for {Adapter#shutdown} DEFAULT_SHUTDOWN_TIMEOUT = -1 # Default to not running cron DEFAULT_ENABLE_CRON = false + # Default to enabling LISTEN/NOTIFY + DEFAULT_ENABLE_LISTEN_NOTIFY = true def self.validate_execution_mode(execution_mode) raise ArgumentError, "GoodJob execution mode must be one of #{EXECUTION_MODES.join(', ')}. It was '#{execution_mode}' which is not valid." unless execution_mode.in?(EXECUTION_MODES) end @@ -327,9 +329,17 @@ # Port of the probe server # @return [nil,Integer] def probe_port options[:probe_port] || env['GOOD_JOB_PROBE_PORT'] + end + + def enable_listen_notify + return options[:enable_listen_notify] unless options[:enable_listen_notify].nil? + return rails_config[:enable_listen_notify] unless rails_config[:enable_listen_notify].nil? + return ActiveModel::Type::Boolean.new.cast(env['GOOD_JOB_ENABLE_LISTEN_NOTIFY']) unless env['GOOD_JOB_ENABLE_LISTEN_NOTIFY'].nil? + + DEFAULT_ENABLE_LISTEN_NOTIFY end private def rails_config