Module: RailsOnboarding::BackgroundJobs::ClassMethods

Defined in:
lib/rails_onboarding/background_jobs.rb

Instance Method Summary collapse

Instance Method Details

#background_job_optionsObject



29
30
31
# File 'lib/rails_onboarding/background_jobs.rb', line 29

def background_job_options
  @background_job_options || {}
end

#configure_background_jobs(options = {}) ⇒ Object

Configure background job options



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails_onboarding/background_jobs.rb', line 15

def configure_background_jobs(options = {})
  @background_job_options = {
    adapter: options.fetch(:adapter, :active_job),
    queue: options.fetch(:queue, :default),
    enable_emails: options.fetch(:enable_emails, true),
    enable_notifications: options.fetch(:enable_notifications, true),
    retry_limit: options.fetch(:retry_limit, 3),
    retry_delay: options.fetch(:retry_delay, 5.minutes),
    enable_throttling: options.fetch(:enable_throttling, true),
    max_jobs_per_user_per_hour: options.fetch(:max_jobs_per_user_per_hour, MAX_JOBS_PER_USER_PER_HOUR),
    max_total_jobs_per_minute: options.fetch(:max_total_jobs_per_minute, MAX_TOTAL_JOBS_PER_MINUTE)
  }.merge(options)
end