lib/promscrape: fix possible deadlock in parallel execution of target relabeling

This commit is contained in:
Aliaksandr Valialkin 2021-02-28 16:05:13 +02:00
parent 68a0f5ce12
commit 59a31171e3

View file

@ -611,9 +611,9 @@ func appendScrapeWorkForTargetLabels(dst []*ScrapeWork, swc *scrapeWorkConfig, t
sw *ScrapeWork
err error
}
resultCh := make(chan result)
workCh := make(chan map[string]string)
goroutines := cgroup.AvailableCPUs()
resultCh := make(chan result, len(targetLabels))
workCh := make(chan map[string]string, goroutines)
for i := 0; i < goroutines; i++ {
go func() {
for metaLabels := range workCh {