mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-02-14 07:01:45 +01:00
Goroutine creation can be simplified using WaitGroup.Go (modernize)
This commit is contained in:
@@ -102,9 +102,7 @@ func (c *metricCache) Start() {
|
||||
return oldPeriod
|
||||
}
|
||||
|
||||
c.wg.Add(1)
|
||||
go func() {
|
||||
defer c.wg.Done()
|
||||
c.wg.Go(func() {
|
||||
for {
|
||||
select {
|
||||
case <-c.done:
|
||||
@@ -124,7 +122,7 @@ func (c *metricCache) Start() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
cclog.ComponentDebug("MetricCache", "START")
|
||||
}
|
||||
|
||||
|
||||
@@ -291,9 +291,7 @@ func (r *metricRouter) Start() {
|
||||
r.cache.Start()
|
||||
}
|
||||
|
||||
r.wg.Add(1)
|
||||
go func() {
|
||||
defer r.wg.Done()
|
||||
r.wg.Go(func() {
|
||||
|
||||
for {
|
||||
select {
|
||||
@@ -324,7 +322,7 @@ func (r *metricRouter) Start() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
cclog.ComponentDebug("MetricRouter", "STARTED")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user