Sha256: 061d5cd07b7a3dda20bde47f4adead98e47d8d21a7c850e6b1245548a151dde1

Contents?: true

Size: 930 Bytes

Versions: 12

Compression:

Stored size: 930 Bytes

Contents

# frozen_string_literal: true
module GoodJob
  # Ruby on Rails integration.
  class Railtie < ::Rails::Railtie
    config.good_job = ActiveSupport::OrderedOptions.new
    config.good_job.cron = {}

    initializer "good_job.logger" do |_app|
      ActiveSupport.on_load(:good_job) do
        self.logger = ::Rails.logger
      end
      GoodJob::LogSubscriber.attach_to :good_job
    end

    initializer "good_job.active_job_notifications" do
      ActiveSupport::Notifications.subscribe "enqueue_retry.active_job" do |event|
        GoodJob::CurrentThread.error_on_retry = event.payload[:error]
      end

      ActiveSupport::Notifications.subscribe "discard.active_job" do |event|
        GoodJob::CurrentThread.error_on_discard = event.payload[:error]
      end
    end

    config.after_initialize do
      GoodJob::Scheduler.instances.each(&:warm_cache)
      GoodJob::CronManager.instances.each(&:start)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
good_job-2.7.1 lib/good_job/railtie.rb
good_job-2.7.0 lib/good_job/railtie.rb
good_job-2.6.2 lib/good_job/railtie.rb
good_job-2.6.1 lib/good_job/railtie.rb
good_job-2.6.0 lib/good_job/railtie.rb
good_job-2.5.0 lib/good_job/railtie.rb
good_job-2.4.2 lib/good_job/railtie.rb
good_job-2.4.1 lib/good_job/railtie.rb
good_job-2.4.0 lib/good_job/railtie.rb
good_job-2.3.1 lib/good_job/railtie.rb
good_job-2.3.0 lib/good_job/railtie.rb
good_job-2.2.0 lib/good_job/railtie.rb