Thread -> pmap (easier to use, them effect)
This commit is contained in:
parent
b71aad8a3c
commit
df3dc42eb9
|
@ -4,6 +4,7 @@ require 'pathname'
|
|||
require 'prometheus/client'
|
||||
require 'lxc'
|
||||
require 'ostruct'
|
||||
require 'pmap'
|
||||
|
||||
require_relative 'ns'
|
||||
require_relative 'file-statfs'
|
||||
|
@ -199,8 +200,7 @@ class LxcCollector
|
|||
@state.set CTStates[ct.state], labels: labels
|
||||
end
|
||||
|
||||
LXC.running_containers.map do |ct|
|
||||
Thread.new ct do |ct|
|
||||
LXC.running_containers.peach do |ct|
|
||||
pid, io = CBORIO.popen(:r) {|io| forked2 io, ct }
|
||||
begin
|
||||
io.map do |l|
|
||||
|
@ -238,7 +238,6 @@ class LxcCollector
|
|||
Process.wait pid
|
||||
end
|
||||
end
|
||||
end.each &:join
|
||||
@prometheus
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue