class Sidekiq::DeadSet


fix. They will be removed after 6 months (dead_timeout) if not.
their retries and are helding in this set pending some sort of manual
The set of dead jobs within Sidekiq. Dead jobs have failed all of
#

def initialize

def initialize
  super("dead")
end

def kill(message, opts = {})

Options Hash: (**opts)
  • :ex (Exception) -- An exception to pass to the death handlers
  • :trim (Boolean) -- Whether Sidekiq should trim the structure to keep it within configuration
  • :notify_failure (Boolean) -- Whether death handlers should be called

Parameters:
  • message (String) -- the job data as JSON
def kill(message, opts = {})
  now = Time.now.to_f
  Sidekiq.redis do |conn|
    conn.zadd(name, now.to_s, message)
  end
  trim if opts[:trim] != false
  if opts[:notify_failure] != false
    job = Sidekiq.load_json(message)
    if opts[:ex]
      ex = opts[:ex]
    else
      ex = RuntimeError.new("Job killed by API")
      ex.set_backtrace(caller)
    end
    Sidekiq.default_configuration.death_handlers.each do |handle|
      handle.call(job, ex)
    end
  end
  true
end

def trim

Trim dead jobs which are over our storage limits
def trim
  hash = Sidekiq.default_configuration
  now = Time.now.to_f
  Sidekiq.redis do |conn|
    conn.multi do |transaction|
      transaction.zremrangebyscore(name, "-inf", now - hash[:dead_timeout_in_seconds])
      transaction.zremrangebyrank(name, 0, - hash[:dead_max_jobs])
    end
  end
end