Class: InstDataShipper::Jobs::AsyncCaller

Inherits:
Base
  • Object
show all
Defined in:
lib/inst_data_shipper/jobs/async_caller.rb

Instance Attribute Summary

Attributes inherited from Base

#start_time

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#working_dir

Class Method Details

.call_from_pool(pool, clazz, method, *args, **kwargs) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/inst_data_shipper/jobs/async_caller.rb', line 13

def self.call_from_pool(pool, clazz, method, *args, **kwargs)
  pool.add_job(
    job: self,
    args: [clazz.to_s, method.to_s, *args],
    kwargs: kwargs,
  )
end

.get_sidekiq_optionsObject



9
10
11
# File 'lib/inst_data_shipper/jobs/async_caller.rb', line 9

def self.get_sidekiq_options
  { retry: 0 }
end

Instance Method Details

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



21
22
23
24
# File 'lib/inst_data_shipper/jobs/async_caller.rb', line 21

def perform(clazz, method, *args, **kwargs)
  clazz = clazz.constantize if clazz.is_a?(String)
  clazz.new(executor: self).send(method.to_sym, *args, **kwargs)
end