Sha256: 46a3ba746ab207ba60ac0a1e6111ad09e53cdf25342d2c7f136a535376e02b9e

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

module AcidicJob
  # NOTE: it is essential that this be a bare module and not an ActiveSupport::Concern
  # WHY?
  module PerformWrapper
    def perform(*args)
      @arguments = args

      # we don't want to run the `perform` callbacks twice, since ActiveJob already handles that for us
      if defined?(::ActiveJob) && self.class < ::ActiveJob::Base
        super(*args)
      elsif defined?(::Sidekiq) && self.class.include?(::Sidekiq::Worker)
        run_callbacks :perform do
          super(*args)
        end
      else
        raise UnknownJobAdapter
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acidic_job-0.8.5 lib/acidic_job/perform_wrapper.rb
acidic_job-0.8.4 lib/acidic_job/perform_wrapper.rb
acidic_job-0.8.3 lib/acidic_job/perform_wrapper.rb
acidic_job-0.8.2 lib/acidic_job/perform_wrapper.rb