1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/lib/sidekiq/stats.rb
2012-12-04 17:11:12 -05:00

13 lines
274 B
Ruby

module Sidekiq
module_function
def size(*queues)
return Sidekiq::Stats.new.enqueued if queues.empty?
Sidekiq.redis { |conn|
conn.multi {
queues.map { |q| conn.llen("queue:#{q}") }
}
}.inject(0) { |memo, count| memo += count }
end
end