Sha256: e8c1b6b084b63a72e7f35a9d7896565ec59cb86734dfd73ae8fbecbc0385dd69

Contents?: true

Size: 677 Bytes

Versions: 17

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

module AcidicJob
  # NOTE: it is essential that this be a bare module and not an ActiveSupport::Concern
  module PerformWrapper
    def perform(*args, **kwargs)
      @__acidic_job_args = args
      @__acidic_job_kwargs = kwargs

      # 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, **kwargs)
      elsif defined?(Sidekiq) && self.class.include?(Sidekiq::Worker)
        run_callbacks :perform do
          super(*args, **kwargs)
        end
      else
        raise UnknownJobAdapter
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
acidic_job-1.0.0.pre29 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre28 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre27 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre26 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre25 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre24 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre23 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre22 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre21 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre20 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre19 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre18 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre17 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre16 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre15 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre14 lib/acidic_job/perform_wrapper.rb
acidic_job-1.0.0.pre13 lib/acidic_job/perform_wrapper.rb