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.16.2 lib/good_job/dependencies.rb
good_job-3.16.1 lib/good_job/dependencies.rb
good_job-3.16.0 lib/good_job/dependencies.rb
good_job-3.15.14 lib/good_job/dependencies.rb
good_job-3.15.13 lib/good_job/dependencies.rb
good_job-3.15.12 lib/good_job/dependencies.rb
good_job-3.15.11 lib/good_job/dependencies.rb
good_job-3.15.10 lib/good_job/dependencies.rb
good_job-3.15.9 lib/good_job/dependencies.rb
good_job-3.15.8 lib/good_job/dependencies.rb
good_job-3.15.7 lib/good_job/dependencies.rb
good_job-3.15.6 lib/good_job/dependencies.rb
good_job-3.15.5 lib/good_job/dependencies.rb
good_job-3.15.4 lib/good_job/dependencies.rb
good_job-3.15.3 lib/good_job/dependencies.rb