Class: Sidekiq::Stats::Queues
- Inherits:
-
Object
- Object
- Sidekiq::Stats::Queues
- Defined in:
- lib/sidekiq/api.rb
Instance Method Summary collapse
Instance Method Details
#lengths ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/sidekiq/api.rb', line 133 def lengths Sidekiq.redis do |conn| queues = conn.sscan_each("queues").to_a lengths = conn.pipelined { queues.each do |queue| conn.llen("queue:#{queue}") end } array_of_arrays = queues.zip(lengths).sort_by { |_, size| -size } Hash[array_of_arrays] end end |