Sha256: 53cbca93822b0a487b023fac8d50d3897ecea9675d7c8985c260a37155d49df8

Contents?: true

Size: 612 Bytes

Versions: 11

Compression:

Stored size: 612 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

11 entries across 11 versions & 1 rubygems

Version Path
acidic_job-0.8.1 lib/acidic_job/perform_wrapper.rb
acidic_job-0.8.0 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.10 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.9 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.8 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.7 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.6 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.5 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.4 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.3 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.beta.2 lib/acidic_job/perform_wrapper.rb