Sha256: c7b866d758f8ae22f9796752f49b187ed0bac269877352ea413fcda1cc7a3276

Contents?: true

Size: 552 Bytes

Versions: 5

Compression:

Stored size: 552 Bytes

Contents

require 'unique_job/util'

module UniqueJob
  class ClientMiddleware
    include Util

    def initialize(redis_options)
      @redis_options = redis_options
    end

    def call(worker_str, job, queue, redis_pool, &block)
      if job.has_key?('at')
        # perform_in or perform_at
        yield
      else
        if worker_str.class == String
          worker = worker_str.constantize.new # Sidekiq < 6
        else
          worker = worker_str.new
        end
        perform_if_unique(worker, job['args'], &block)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unique_job-0.4.3 lib/unique_job/client_middleware.rb
unique_job-0.4.2 lib/unique_job/client_middleware.rb
unique_job-0.4.1 lib/unique_job/client_middleware.rb
unique_job-0.4.0 lib/unique_job/client_middleware.rb
unique_job-0.3.2.pre lib/unique_job/client_middleware.rb