class Sidekiq::ProfileSet
def each(&block)
def each(&block) fetch_keys = %w[started_at jid type token size elapsed].freeze arrays = Sidekiq.redis do |c| c.pipelined do |p| @records.each do |key| p.hmget(key, *fetch_keys) end end end arrays.compact.map { |arr| ProfileRecord.new(arr) }.each(&block) end
def initialize
This is a point in time/snapshot API, you'll need to instantiate a new instance
def initialize @records = Sidekiq.redis do |c| # This throws away expired profiles c.zremrangebyscore("profiles", "-inf", Time.now.to_f.to_s) # retreive records, newest to oldest c.zrange("profiles", "+inf", 0, "byscore", "rev") end end
def size
def size @records.size end