Merge pull request #376 from martinlindhe/fix-goroutine-leak

Fix goroutine leak
This commit is contained in:
Calle Pettersson
2019-08-09 10:24:36 +02:00
committed by GitHub

View File

@@ -5,6 +5,7 @@ package main
import ( import (
"fmt" "fmt"
"net/http" "net/http"
_ "net/http/pprof"
"os" "os"
"sort" "sort"
"strconv" "strconv"
@@ -144,6 +145,7 @@ func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) {
go func() { go func() {
wg.Wait() wg.Wait()
close(allDone) close(allDone)
close(metricsBuffer)
}() }()
// Wait until either all collectors finish, or timeout expires // Wait until either all collectors finish, or timeout expires