mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/netutil: parallelize background pings for remote addresses
This should improve the time needed for determining unavailale remote addresses
across big numer of ConnPool's.
This is a follow-up for a1629bd3be
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/711
This commit is contained in:
parent
24097f2417
commit
288d13af8d
1 changed files with 7 additions and 1 deletions
|
@ -222,8 +222,14 @@ var connPools []*ConnPool
|
||||||
|
|
||||||
func forEachConnPool(f func(cp *ConnPool)) {
|
func forEachConnPool(f func(cp *ConnPool)) {
|
||||||
connPoolsMu.Lock()
|
connPoolsMu.Lock()
|
||||||
|
var wg sync.WaitGroup
|
||||||
for _, cp := range connPools {
|
for _, cp := range connPools {
|
||||||
f(cp)
|
wg.Add(1)
|
||||||
|
go func(cp *ConnPool) {
|
||||||
|
defer wg.Done()
|
||||||
|
f(cp)
|
||||||
|
}(cp)
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
connPoolsMu.Unlock()
|
connPoolsMu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue