Sha256: 873912f08fafd7364f047fb39bca673755dd5e49889ddc3a8a1bad505a3051d0

Contents?: true

Size: 805 Bytes

Versions: 75

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

module GoodJob # :nodoc:
  # Extends GoodJob module to track Rails boot dependencies.
  module Dependencies
    extend ActiveSupport::Concern

    included do
      mattr_accessor :_framework_ready, default: false
    end

    class_methods do
      # Whether Rails framework has sufficiently initialized to enable Async execution.
      def async_ready?
        Rails.application.initialized? || _framework_ready
      end

      def _start_async_adapters
        return unless async_ready?

        ActiveJob::Base.queue_adapter # Ensure Active Job is initialized
        GoodJob::Adapter.instances
                        .select(&:execute_async?)
                        .reject(&:async_started?)
                        .each(&:start_async)
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
good_job-3.30.0 lib/good_job/dependencies.rb
good_job-3.29.5 lib/good_job/dependencies.rb
good_job-3.29.4 lib/good_job/dependencies.rb
good_job-3.29.3 lib/good_job/dependencies.rb
good_job-3.28.2 lib/good_job/dependencies.rb
good_job-3.28.1 lib/good_job/dependencies.rb
good_job-3.28.0 lib/good_job/dependencies.rb
good_job-3.27.4 lib/good_job/dependencies.rb
good_job-3.27.3 lib/good_job/dependencies.rb
good_job-3.27.0 lib/good_job/dependencies.rb
good_job-3.26.2 lib/good_job/dependencies.rb
good_job-3.26.1 lib/good_job/dependencies.rb
good_job-3.26.0 lib/good_job/dependencies.rb
good_job-3.25.0 lib/good_job/dependencies.rb
good_job-3.24.0 lib/good_job/dependencies.rb
good_job-3.23.0 lib/good_job/dependencies.rb
good_job-3.22.0 lib/good_job/dependencies.rb
good_job-3.21.5 lib/good_job/dependencies.rb
good_job-3.21.4 lib/good_job/dependencies.rb
good_job-3.21.3 lib/good_job/dependencies.rb