Sha256: 40bfd559f566d34f2d0152172f530c542fad27ff43c4dfa5c6dc9309574f6447

Contents?: true

Size: 652 Bytes

Versions: 8

Compression:

Stored size: 652 Bytes

Contents

require "sidekiq"

module InstDataShipper
  module Jobs
    class AsyncCaller < InstDataShipper::Jobs::Base
      sidekiq_options(retry: 0) if defined?(sidekiq_options)

      def self.get_sidekiq_options
        { retry: 0 }
      end

      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

      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
inst_data_shipper-0.2.6 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.2.5 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.2.4 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.2.3 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.2.2 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.2.1 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.2.0 lib/inst_data_shipper/jobs/async_caller.rb
inst_data_shipper-0.1.0.beta2 lib/inst_data_shipper/jobs/async_caller.rb