mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Allows configuration of the Dead Job Queue.
This commit is contained in:
parent
32e1a414f1
commit
b9c2982638
4 changed files with 19 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
|||
3.3.2 (unreleased)
|
||||
-----------
|
||||
- Allows configuration of dead job set size and timeout
|
||||
|
||||
3.3.1
|
||||
-----------
|
||||
|
||||
|
|
|
@ -25,7 +25,9 @@ module Sidekiq
|
|||
startup: [],
|
||||
quiet: [],
|
||||
shutdown: [],
|
||||
}
|
||||
},
|
||||
dead_max_jobs: 10_000,
|
||||
dead_timeout_in_seconds: 180 * 24 * 60 * 60 # 6 months
|
||||
}
|
||||
|
||||
def self.❨╯°□°❩╯︵┻━┻
|
||||
|
|
|
@ -399,8 +399,8 @@ module Sidekiq
|
|||
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
|
||||
|
@ -593,9 +593,6 @@ module Sidekiq
|
|||
# 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
|
||||
|
@ -605,6 +602,14 @@ module Sidekiq
|
|||
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
|
||||
|
||||
##
|
||||
|
|
|
@ -156,8 +156,8 @@ module Sidekiq
|
|||
Sidekiq.redis do |conn|
|
||||
conn.multi do
|
||||
conn.zadd('dead', now, payload)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue