Sha256: e337b91a29b27863193831f880ef7263150b0b931955c38f1717e8413b005d09

Contents?: true

Size: 695 Bytes

Versions: 17

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  module ActiveJobExtensions
    module Batches
      extend ActiveSupport::Concern

      included do
        before_enqueue do |job|
          GoodJob.logger.debug("#{job.class} was enqueued within a batch or bulk capture block but is not using the GoodJob Adapter; the job will not appear in GoodJob.") if (GoodJob::Bulk.current_buffer || GoodJob::Batch.current_batch_id) && !job.class.queue_adapter.is_a?(GoodJob::Adapter)
        end
      end

      def batch
        @_batch ||= CurrentThread.job&.batch&.to_batch if CurrentThread.job.present? && CurrentThread.job.active_job_id == job_id
      end
      alias batch? batch
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
good_job-4.8.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.7.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.6.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.5.1 lib/good_job/active_job_extensions/batches.rb
good_job-4.5.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.4.2 lib/good_job/active_job_extensions/batches.rb
good_job-4.4.1 lib/good_job/active_job_extensions/batches.rb
good_job-4.4.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.3.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.2.1 lib/good_job/active_job_extensions/batches.rb
good_job-4.2.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.1.1 lib/good_job/active_job_extensions/batches.rb
good_job-4.1.0 lib/good_job/active_job_extensions/batches.rb
good_job-4.0.3 lib/good_job/active_job_extensions/batches.rb
good_job-4.0.2 lib/good_job/active_job_extensions/batches.rb
good_job-4.0.1 lib/good_job/active_job_extensions/batches.rb
good_job-4.0.0 lib/good_job/active_job_extensions/batches.rb