mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -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[:count][:pool] = {}
|
||||||
task[:duration][: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'
|
pool = 'unknown'
|
||||||
hostname = 'unknown'
|
hostname = 'unknown'
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ module Vmpooler
|
||||||
task[:duration][:pool][pool] ||= {}
|
task[:duration][:pool][pool] ||= {}
|
||||||
|
|
||||||
task_times_bypool[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
|
end
|
||||||
|
|
||||||
task_times_bypool.each_key do |pool|
|
task_times_bypool.each_key do |pool|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue