Module: AcidicJob::PerformWrapper

Defined in:
lib/acidic_job/perform_wrapper.rb

Overview

NOTE: it is essential that this be a bare module and not an ActiveSupport::Concern

Instance Method Summary collapse

Instance Method Details

#perform(*args, **kwargs) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/acidic_job/perform_wrapper.rb', line 6

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