Wait for close of done channel, to ensure manager finished.

This commit is contained in:
Holger Obermaier
2022-01-30 12:08:33 +01:00
parent 8df58c051f
commit 9e99e47d73
4 changed files with 15 additions and 0 deletions

View File

@@ -115,6 +115,7 @@ func (cm *collectorManager) Start() {
for _, c := range cm.collectors {
c.Close()
}
close(cm.done)
cclog.ComponentDebug("CollectorManager", "DONE")
}
@@ -154,6 +155,8 @@ func (cm *collectorManager) AddOutput(output chan lp.CCMetric) {
func (cm *collectorManager) Close() {
cclog.ComponentDebug("CollectorManager", "CLOSE")
cm.done <- true
// wait for close of channel cm.done
<-cm.done
}
// New creates a new initialized metric collector manager