1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

retry_jobs now requires the sidekiq API due to recent constant extraction, fixes #1915

This commit is contained in:
Mike Perham 2014-08-28 08:56:56 -07:00
parent dffdd22bab
commit 055fdfd894
2 changed files with 4 additions and 6 deletions

View file

@ -326,7 +326,7 @@ module Sidekiq
Sidekiq.redis do |conn|
conn.multi do
conn.zadd('dead', now, message)
conn.zremrangebyscore('dead', '-inf', now - DeadSet::DEAD_JOB_TIMEOUT)
conn.zremrangebyscore('dead', '-inf', now - DeadSet::TIMEOUT)
conn.zremrangebyrank('dead', 0, - DeadSet::MAX_JOBS)
end
end
@ -520,7 +520,7 @@ module Sidekiq
# Allows enumeration of dead jobs within Sidekiq.
#
class DeadSet < JobSet
DEAD_JOB_TIMEOUT = 180 * 24 * 60 * 60 # 6 months
TIMEOUT = 180 * 24 * 60 * 60 # 6 months
MAX_JOBS = 10_000
def initialize

View file

@ -1,4 +1,5 @@
require 'sidekiq/scheduled'
require 'sidekiq/api'
module Sidekiq
module Middleware
@ -131,9 +132,6 @@ module Sidekiq
private
DEAD_JOB_TIMEOUT = 180 * 24 * 60 * 60 # 6 months
MAX_JOBS = 10_000
def retries_exhausted(worker, msg)
logger.debug { "Dropping message after hitting the retry maximum: #{msg}" }
begin
@ -154,7 +152,7 @@ module Sidekiq
Sidekiq.redis do |conn|
conn.multi do
conn.zadd('dead', now, payload)
conn.zremrangebyscore('dead', '-inf', now - DeadSet::DEAD_JOB_TIMEOUT)
conn.zremrangebyscore('dead', '-inf', now - DeadSet::TIMEOUT)
conn.zremrangebyrank('dead', 0, -DeadSet::MAX_JOBS)
end
end