mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add TTL for stats keys
This change adds a 5 years TTL on redis keys containing daily stats. See #3905 for more details
This commit is contained in:
parent
e339d23036
commit
03e63b8c99
1 changed files with 6 additions and 0 deletions
|
@ -13,6 +13,8 @@ module Sidekiq
|
|||
|
||||
attr_accessor :manager, :poller, :fetcher
|
||||
|
||||
STATS_TTL = 5*365*24*60*60
|
||||
|
||||
def initialize(options)
|
||||
@manager = Sidekiq::Manager.new(options)
|
||||
@poller = Sidekiq::Scheduled::Poller.new
|
||||
|
@ -81,8 +83,12 @@ module Sidekiq
|
|||
conn.multi do
|
||||
conn.incrby("stat:processed", procd)
|
||||
conn.incrby("stat:processed:#{nowdate}", procd)
|
||||
conn.expire("stat:processed:#{nowdate}", STATS_TTL)
|
||||
|
||||
conn.incrby("stat:failed", fails)
|
||||
conn.incrby("stat:failed:#{nowdate}", fails)
|
||||
conn.expire("stat:failed:#{nowdate}", STATS_TTL)
|
||||
|
||||
conn.del(workers_key)
|
||||
Processor::WORKER_STATE.each_pair do |tid, hash|
|
||||
conn.hset(workers_key, tid, Sidekiq.dump_json(hash))
|
||||
|
|
Loading…
Reference in a new issue