class Sidekiq::WorkSet
def size
processes but the alternative is a global counter
Not very efficient if you have lots of Sidekiq
which happens every 5 seconds. It is NOT real-time.
Note that #size is only as accurate as Sidekiq's heartbeat,
def size Sidekiq.redis do |conn| procs = conn.sscan("processes").to_a if procs.empty? 0 else conn.pipelined { |pipeline| procs.each do |key| pipeline.hget(key, "busy") end }.sum(&:to_i) end end end