class SidekiqUniqueJobs::Locksmith
def initialize(item, redis_pool = nil)
-
redis_pool
(Sidekiq::RedisConnection, ConnectionPool
) -- the redis connection -
item
(Hash
) -- a Sidekiq job hash
Options Hash:
(**item)
-
:unique_digest
(String
) -- the unique digest (See: {LockDigest#lock_digest}) -
:jid
(String
) -- the sidekiq job id -
:lock_ttl
(Integer
) -- the configured expiration
def initialize(item, redis_pool = nil) @item = item @key = Key.new(item[LOCK_DIGEST] || item[UNIQUE_DIGEST]) # fallback until can be removed @job_id = item[JID] @config = LockConfig.new(item) @redis_pool = redis_pool end