Class: Sidekiq::DeadSet
Overview
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.
Instance Attribute Summary
Attributes inherited from SortedSet
Instance Method Summary collapse
-
#initialize ⇒ DeadSet
constructor
A new instance of DeadSet.
-
#kill(message, opts = {}) ⇒ Object
Add the given job to the Dead set.
-
#retry_all ⇒ Object
Enqueue all dead jobs.
Methods inherited from JobSet
#each, #fetch, #find_job, #schedule
Methods inherited from SortedSet
Constructor Details
#initialize ⇒ DeadSet
Returns a new instance of DeadSet.
784 785 786 |
# File 'lib/sidekiq/api.rb', line 784 def initialize super "dead" end |
Instance Method Details
#kill(message, opts = {}) ⇒ Object
Add the given job to the Dead set.
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/sidekiq/api.rb', line 790 def kill(, opts = {}) now = Time.now.to_f Sidekiq.redis do |conn| conn.multi do |transaction| transaction.zadd(name, now.to_s, ) transaction.zremrangebyscore(name, "-inf", now - Sidekiq::Config::DEFAULTS[:dead_timeout_in_seconds]) transaction.zremrangebyrank(name, 0, - Sidekiq::Config::DEFAULTS[:dead_max_jobs]) end end if opts[:notify_failure] != false job = Sidekiq.load_json() r = RuntimeError.new("Job killed by API") r.set_backtrace(caller) Sidekiq.default_configuration.death_handlers.each do |handle| handle.call(job, r) end end true end |
#retry_all ⇒ Object
Enqueue all dead jobs
812 813 814 |
# File 'lib/sidekiq/api.rb', line 812 def retry_all each(&:retry) while size > 0 end |