lib/good_job/configuration.rb in good_job-4.7.0 vs lib/good_job/configuration.rb in good_job-4.8.0
- old
+ new
@@ -33,10 +33,12 @@
DEFAULT_DASHBOARD_DEFAULT_LOCALE = :en
# Default Dashboard Live Poll button enabled
DEFAULT_DASHBOARD_LIVE_POLL_ENABLED = true
# Default enqueue_after_transaction_commit
DEFAULT_ENQUEUE_AFTER_TRANSACTION_COMMIT = false
+ # Default enable_pauses setting
+ DEFAULT_ENABLE_PAUSES = false
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
@@ -365,9 +367,19 @@
# @return [Boolean]
def enqueue_after_transaction_commit
return options[:enqueue_after_transaction_commit] unless options[:enqueue_after_transaction_commit].nil?
DEFAULT_ENQUEUE_AFTER_TRANSACTION_COMMIT
+ end
+
+ # Whether the job processing can be paused.
+ # @return [Boolean]
+ def enable_pauses
+ return options[:enable_pauses] unless options[:enable_pauses].nil?
+ return rails_config[:enable_pauses] unless rails_config[:enable_pauses].nil?
+ return ActiveModel::Type::Boolean.new.cast(env['GOOD_JOB_ENABLE_PAUSES']) unless env['GOOD_JOB_ENABLE_PAUSE'].nil?
+
+ DEFAULT_ENABLE_PAUSES
end
# Whether running in a web server process.
# @return [Boolean, nil]
def in_webserver?