lib/sidekiq/api.rb in sidekiq-3.3.1 vs lib/sidekiq/api.rb in sidekiq-3.3.2

- old
+ new

@@ -41,10 +41,14 @@ def default_queue_latency stat :default_queue_latency end + def queues + Sidekiq::Stats::Queues.new.lengths + end + def fetch_stats! pipe1_res = Sidekiq.redis do |conn| conn.pipelined do conn.get('stat:processed'.freeze) conn.get('stat:failed'.freeze) @@ -393,12 +397,12 @@ Sidekiq.logger.info { "Killing job #{message['jid']}" } now = Time.now.to_f Sidekiq.redis do |conn| conn.multi do conn.zadd('dead', now, message) - conn.zremrangebyscore('dead', '-inf', now - DeadSet::TIMEOUT) - conn.zremrangebyrank('dead', 0, - DeadSet::MAX_JOBS) + conn.zremrangebyscore('dead', '-inf', now - DeadSet.timeout) + conn.zremrangebyrank('dead', 0, - DeadSet.max_jobs) end end end end @@ -587,20 +591,25 @@ ## # Allows enumeration of dead jobs within Sidekiq. # class DeadSet < JobSet - TIMEOUT = 180 * 24 * 60 * 60 # 6 months - MAX_JOBS = 10_000 - def initialize super 'dead' end def retry_all while size > 0 each(&:retry) end + end + + def self.max_jobs + Sidekiq.options[:dead_max_jobs] + end + + def self.timeout + Sidekiq.options[:dead_timeout_in_seconds] end end ## # Enumerates the set of Sidekiq processes which are actively working