Class: SidekiqUniqueJobs::Client::Middleware

Inherits:
Object
  • Object
show all
Includes:
Logging, OptionsWithFallback
Defined in:
lib/sidekiq_unique_jobs/client/middleware.rb

Overview

The unique sidekiq middleware for the client push

Author:

Constant Summary

Constants included from OptionsWithFallback

OptionsWithFallback::LOCKS

Instance Method Summary collapse

Methods included from OptionsWithFallback

included, #lock, #lock_class, #lock_type, #log_duplicate_payload?, #options, #unique_disabled?, #unique_enabled?, #unique_type

Methods included from Logging

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context

Instance Method Details

#call(worker_class, item, queue, redis_pool = nil) { ... } ⇒ Object

Calls this client middleware

Used from Sidekiq.process_single

Parameters:

  • worker_class (String)

    name of the sidekiq worker class

  • item (Hash)

    a sidekiq job hash

  • queue (String)

    name of the queue

  • redis_pool (Sidekiq::RedisConnection, ConnectionPool) (defaults to: nil)

    the redis connection

Yields:

  • when uniqueness is disable or lock successful



21
22
23
24
25
26
27
28
# File 'lib/sidekiq_unique_jobs/client/middleware.rb', line 21

def call(worker_class, item, queue, redis_pool = nil)
  @worker_class = worker_class
  @item         = item
  @queue        = queue
  @redis_pool   = redis_pool

  yield if success?
end