Module: RubyReactor::Adapters::ActiveJob::Compat

Included in:
MapCollectorWorker, MapElementWorker, SweeperWorker, Worker
Defined in:
lib/ruby_reactor/adapters/active_job/compat.rb

Overview

Sidekiq::Worker gives every job class .perform_async / .perform_in for free; ActiveJob only has .perform_later. Extending this onto an ActiveJob class normalizes its enqueue API to the same two class methods, so RubyReactor::Worker and RubyReactor::SweeperJob can keep calling self.class.perform_in(...) unchanged regardless of backend. Both methods return the job id (a String), matching what Sidekiq's native perform_async/perform_in return.

Instance Method Summary collapse

Instance Method Details

#perform_async(*args) ⇒ Object



14
15
16
# File 'lib/ruby_reactor/adapters/active_job/compat.rb', line 14

def perform_async(*args)
  perform_later(*args).job_id
end

#perform_in(delay, *args) ⇒ Object



18
19
20
# File 'lib/ruby_reactor/adapters/active_job/compat.rb', line 18

def perform_in(delay, *args)
  set(wait: delay).perform_later(*args).job_id
end