mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(maint) Speedup the tagging method (#422)
* (maint) Speedup the tagging method While looking at the instrumentation data for the ABS queue processor, I noticed a lot of time spent in the HTTP PUT method, which in the code was easy to isolate, as it is only used via the vmpooler tagging functions ie the API /vm/foobar/ with 'tag' key-value pairs. While I'm not sure the original hset() make sense to me, there was an easy way to speed them up by using pipelined. I would expect a very good speed increase with this turned on. * tag rubocop to <1.0 because the 1.0 version returns 130 new offenses
This commit is contained in:
parent
063a6f6d53
commit
0a323f6052
1 changed files with 6 additions and 4 deletions
|
|
@ -114,11 +114,13 @@ module Vmpooler
|
|||
end
|
||||
|
||||
def export_tags(backend, hostname, tags)
|
||||
tags.each_pair do |tag, value|
|
||||
next if value.nil? or value.empty?
|
||||
backend.pipelined do
|
||||
tags.each_pair do |tag, value|
|
||||
next if value.nil? or value.empty?
|
||||
|
||||
backend.hset('vmpooler__vm__' + hostname, 'tag:' + tag, value)
|
||||
backend.hset('vmpooler__tag__' + Date.today.to_s, hostname + ':' + tag, value)
|
||||
backend.hset('vmpooler__vm__' + hostname, 'tag:' + tag, value)
|
||||
backend.hset('vmpooler__tag__' + Date.today.to_s, hostname + ':' + tag, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue