Sha256: 7e0994328af272d06fab2f7bf81da0782c6d42e9e74046266f4ff78bc3aaf975
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
module MultiWorker module Adapters class Sidekiq def self.configure(base, opts={}) base.class_eval do if opts[:status] require 'sidekiq_status' include ::SidekiqStatus::Worker else include ::Sidekiq::Worker end @sidekiq_options = ::Sidekiq.default_worker_options.symbolize_keys @sidekiq_options.merge! queue: opts[:queue] if opts.has_key?(:backtrace) @sidekiq_options.merge! backtrace: opts[:backtrace] end if opts.has_key?(:retry) @retry = opts[:retry] case @retry when Hash @sidekiq_options.merge!(retry: @retry[:limit]) sidekiq_retry_in(&@retry[:delay]) when true, false, Fixnum @sidekiq_options.merge!(retry: @retry) end end if opts[:lock] require 'sidekiq-lock' include ::Sidekiq::Lock::Worker @sidekiq_options.merge!(lock: opts[:lock]) end if opts[:unique] require "sidekiq-unique-jobs" @sidekiq_options.merge!(unique: true) end sidekiq_options @sidekiq_options def self.perform(*args) self.new.perform(*args) end def perform_async(*args) self.class.perform_async(*args) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi_worker-0.2.0 | lib/multi_worker/adapters/sidekiq.rb |