class Sidekiq::Stats::History
def date_stat_hash(stat)
def date_stat_hash(stat) i = 0 stat_hash = {} keys = [] dates = [] while i < @days_previous date = @start_date - i keys << "stat:#{stat}:#{date}" dates << date i += 1 end Sidekiq.redis do |conn| conn.mget(keys).each_with_index do |value, i| stat_hash[dates[i].to_s] = value ? value.to_i : 0 end end stat_hash end
def failed
def failed date_stat_hash("failed") end
def initialize(days_previous, start_date = nil)
def initialize(days_previous, start_date = nil) @days_previous = days_previous @start_date = start_date || Time.now.utc.to_date end
def processed
def processed date_stat_hash("processed") end