Navigation Menu

Skip to content

Commit

Permalink
Avoid use of Array#pop
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelga committed Jan 17, 2015
1 parent 20c616e commit 7cb9f42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/sidekiq/api.rb
Expand Up @@ -52,7 +52,6 @@ def fetch_stats!
conn.zcard('retry')
conn.zcard('dead')
conn.scard('processes')

conn.lrange("queue:default", -1, -1)
conn.smembers('processes')
conn.smembers('queues'.freeze)
Expand All @@ -66,8 +65,9 @@ def fetch_stats!
end
end

workers_size = pipe2_res.pop(pipe1_res[7].size).map(&:to_i).inject(0, &:+)
enqueued = pipe2_res.pop(pipe1_res[8].size).map(&:to_i).inject(0, &:+)
s = pipe1_res[7].size
workers_size = pipe2_res[0...s].map(&:to_i).inject(0, &:+)
enqueued = pipe2_res[s..-1].map(&:to_i).inject(0, &:+)

default_queue_latency = if (entry = pipe1_res[6].first)
Time.now.to_f - Sidekiq.load_json(entry)['enqueued_at']
Expand Down

0 comments on commit 7cb9f42

Please sign in to comment.