Sha256: f1baeb657d04364680be1e789badb2ad126e3f1cb89e61837bb54829360fe76c

Contents?: true

Size: 713 Bytes

Versions: 8

Compression:

Stored size: 713 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.execution&.batch&.to_batch if CurrentThread.execution.present? && CurrentThread.execution.active_job_id == job_id
      end
      alias batch? batch
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
good_job-3.99.1 lib/good_job/active_job_extensions/batches.rb
good_job-3.99.0 lib/good_job/active_job_extensions/batches.rb
good_job-3.30.1 lib/good_job/active_job_extensions/batches.rb
good_job-3.30.0 lib/good_job/active_job_extensions/batches.rb
good_job-3.29.5 lib/good_job/active_job_extensions/batches.rb
good_job-3.29.4 lib/good_job/active_job_extensions/batches.rb
good_job-3.29.3 lib/good_job/active_job_extensions/batches.rb
good_job-3.28.2 lib/good_job/active_job_extensions/batches.rb