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
#aj_job? ⇒ Boolean
23 24 25 |
# File 'lib/acidic_job/perform_wrapper.rb', line 23 def aj_job? defined?(ActiveJob) && self.class < ActiveJob::Base end |
#perform(*args, **kwargs) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/acidic_job/perform_wrapper.rb', line 6 def perform(*args, **kwargs) super_method = method(:perform).super_method # we don't want to run the `perform` callbacks twice, since ActiveJob already handles that for us if aj_job? __acidic_job_perform_for_aj(super_method, *args, **kwargs) elsif sk_job? __acidic_job_perform_for_sk(super_method, *args, **kwargs) else raise UnknownJobAdapter end end |
#sk_job? ⇒ Boolean
19 20 21 |
# File 'lib/acidic_job/perform_wrapper.rb', line 19 def sk_job? defined?(Sidekiq) && self.class.include?(Sidekiq::Worker) end |