Method: WarpCore.dispatch_in
- Defined in:
- lib/warpcore/sidekiq.rb
.dispatch_in(worker_name, *args) ⇒ Object
Asynchronously dispatch a Sidekiq worker at a later time with the provided arguments. This is equivalent to calling the worker directly with perform_in.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/warpcore/sidekiq.rb', line 40 def self.dispatch_in(worker_name, *args) klass = worker_name.constantize if klass.respond_to?(:perform_async) puts "=> [Dispatch:Delay] #{worker_name}" return klass.perform_in(*args) else warn "Dispatched #{worker_name} not a valid Sidekiq worker." nil end rescue NameError => e puts "Worker [#{worker_name}] not defined." nil end |