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 5c9e657808
commit 6f8866a40a

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 {