class Roundhouse::Stats::Queues
Public Instance Methods
lengths()
click to toggle source
# File lib/roundhouse/api.rb, line 151 def lengths Roundhouse.redis do |conn| # Refactor note: this set contains the bucket names, not # the queue names queues = conn.smembers('queues'.freeze) lengths = conn.pipelined do queues.each do |queue| conn.llen("queue:#{queue}") end end i = 0 array_of_arrays = queues.inject({}) do |memo, queue| memo[queue] = lengths[i] i += 1 memo end.sort_by { |_, size| size } Hash[array_of_arrays.reverse] end end