class SidekiqUniqueJobs::LockTimeout

@author Mikael Henriksson <mikael@zoolutions.se>
Calculates timeout and expiration

def self.calculate(item)

Returns:
  • (Integer) - timeout in seconds

Parameters:
  • item (Hash) -- sidekiq job hash
def self.calculate(item)
  new(item).calculate
end

def calculate

Returns:
  • (Integer, nil) -
def calculate
  timeout = default_worker_options[LOCK_TIMEOUT]
  timeout = default_lock_timeout if default_lock_timeout
  timeout = worker_options[LOCK_TIMEOUT] if worker_options.key?(LOCK_TIMEOUT)
  timeout
end

def default_lock_timeout

Returns:
  • (Integer, nil) -

Other tags:
    See: SidekiqUniqueJobs::Config#lock_timeout -
def default_lock_timeout
  SidekiqUniqueJobs.config.lock_timeout
end

def initialize(item)

Options Hash: (**item)
  • :at (Float) -- the unix time the job is scheduled at
  • :class (String) -- the class of the sidekiq worker
  • :lock_timeout (Integer, nil) -- the configured lock timeout
  • :lock_ttl (Integer, nil) -- the configured lock expiration

Parameters:
  • item (Hash) -- the Sidekiq job hash
def initialize(item)
  @item         = item
  @worker_class = item[CLASS]
end