Skip to content

Commit

Permalink
fix wait group usage
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote committed Oct 17, 2023
1 parent a146f55 commit 12eca64
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ func (e *CdnExporter) Collect(ch chan<- prometheus.Metric) {
"Error collecting cdn metrics", nil, nil),
errors.New("empty domain list"))
}
var wg sync.WaitGroup
for _, domain := range *e.domainList {

var wg sync.WaitGroup
domain := domain
wg.Add(1)
go func() {
Expand Down Expand Up @@ -362,6 +361,6 @@ func (e *CdnExporter) Collect(ch chan<- prometheus.Metric) {
)
}
}()
wg.Wait()
}
wg.Wait()
}

0 comments on commit 12eca64

Please sign in to comment.