Class: Sidekiq::DeadSet
Overview
Allows enumeration of dead jobs within Sidekiq.
Instance Attribute Summary
Attributes inherited from SortedSet
#name
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from JobSet
#delete_by_jid, #delete_by_value, #each, #fetch, #find_job, #schedule
Methods inherited from SortedSet
#clear, #size
Constructor Details
Returns a new instance of DeadSet.
685
686
687
|
# File 'lib/sidekiq/api.rb', line 685
def initialize
super 'dead'
end
|
Class Method Details
.max_jobs ⇒ Object
716
717
718
|
# File 'lib/sidekiq/api.rb', line 716
def self.max_jobs
Sidekiq.options[:dead_max_jobs]
end
|
.timeout ⇒ Object
720
721
722
|
# File 'lib/sidekiq/api.rb', line 720
def self.timeout
Sidekiq.options[:dead_timeout_in_seconds]
end
|
Instance Method Details
#kill(message, opts = {}) ⇒ Object
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
|
# File 'lib/sidekiq/api.rb', line 689
def kill(message, opts={})
now = Time.now.to_f
Sidekiq.redis do |conn|
conn.multi do
conn.zadd(name, now.to_s, message)
conn.zremrangebyscore(name, '-inf', now - self.class.timeout)
conn.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 ⇒ Object
710
711
712
713
714
|
# File 'lib/sidekiq/api.rb', line 710
def retry_all
while size > 0
each(&:retry)
end
end
|