class Sidekiq::DeadSet
The set of dead jobs within Sidekiq
. Dead jobs have failed all of their retries and are helding in this set pending some sort of manual fix. They will be removed after 6 months (dead_timeout) if not.
Public Class Methods
max_jobs()
click to toggle source
The maximum size of the Dead set. Older entries will be trimmed to stay within this limit. Default value is 10,000.
# File lib/sidekiq/api.rb, line 875 def self.max_jobs Sidekiq[:dead_max_jobs] end
new()
click to toggle source
Calls superclass method
# File lib/sidekiq/api.rb, line 841 def initialize super "dead" end
timeout()
click to toggle source
The time limit for entries within the Dead set. Older entries will be thrown away. Default value is six months.
# File lib/sidekiq/api.rb, line 881 def self.timeout Sidekiq[:dead_timeout_in_seconds] end
Public Instance Methods
kill(message, opts = {})
click to toggle source
Add the given job to the Dead set. @param message [String] the job data as JSON
# File lib/sidekiq/api.rb, line 847 def kill(message, opts = {}) now = Time.now.to_f Sidekiq.redis do |conn| conn.multi do |transaction| transaction.zadd(name, now.to_s, message) transaction.zremrangebyscore(name, "-inf", now - self.class.timeout) transaction.zremrangebyrank(name, 0, - self.class.max_jobs) end end if opts[:notify_failure] != false job = Sidekiq.load_json(message) r = RuntimeError.new("Job killed by API") r.set_backtrace(caller) Sidekiq.death_handlers.each do |handle| handle.call(job, r) end end true end
retry_all()
click to toggle source
Enqueue all dead jobs
# File lib/sidekiq/api.rb, line 869 def retry_all each(&:retry) while size > 0 end