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

14 lines
274 B
Ruby
Raw Normal View History

2012-09-03 13:37:54 -04:00
module Sidekiq
module_function
2012-09-03 13:37:54 -04:00
2012-12-04 12:13:47 -05:00
def size(*queues)
2012-12-04 17:10:42 -05:00
return Sidekiq::Stats.new.enqueued if queues.empty?
2012-12-04 12:13:47 -05:00
Sidekiq.redis { |conn|
conn.multi {
queues.map { |q| conn.llen("queue:#{q}") }
}
}.inject(0) { |memo, count| memo += count }
end
2012-09-03 13:37:54 -04:00
end