mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Use $redis.hgetall rather than hget in a loop
This cuts down on render-time for the /api/v1/summary endpoint drastically.
This commit is contained in:
parent
6409dedd3e
commit
558c70ab0d
1 changed files with 2 additions and 2 deletions
|
|
@ -76,7 +76,7 @@ module Vmpooler
|
|||
task[:count][:pool] = {}
|
||||
task[:duration][:pool] = {}
|
||||
|
||||
$redis.hkeys('vmpooler__' + task_str + '__' + date_str).each do |key|
|
||||
$redis.hgetall('vmpooler__' + task_str + '__' + date_str).each do |key, value|
|
||||
pool = 'unknown'
|
||||
hostname = 'unknown'
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ module Vmpooler
|
|||
task[:duration][:pool][pool] ||= {}
|
||||
|
||||
task_times_bypool[pool] ||= []
|
||||
task_times_bypool[pool].push($redis.hget('vmpooler__' + task_str + '__' + date_str, key).to_f)
|
||||
task_times_bypool[pool].push(value.to_f)
|
||||
end
|
||||
|
||||
task_times_bypool.each_key do |pool|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue