diff --git a/pkg/monitoring/collector.go b/pkg/monitoring/collector.go index 0a79be36..eb18302e 100644 --- a/pkg/monitoring/collector.go +++ b/pkg/monitoring/collector.go @@ -53,7 +53,7 @@ type basicCollector struct { logger logr.Logger } -// only use with Lock called before +// only use with Lock called before. func (c *basicCollector) clearChannels() { defer c.mu.Unlock() c.channels = []chan<- prometheus.Metric{} diff --git a/pkg/monitoring/frr.go b/pkg/monitoring/frr.go index e3f9ed0d..abd2991d 100644 --- a/pkg/monitoring/frr.go +++ b/pkg/monitoring/frr.go @@ -253,14 +253,14 @@ func (c *frrCollector) Update(ch chan<- prometheus.Metric) error { if len(c.channels) == 1 { c.wg = sync.WaitGroup{} c.wg.Add(1) - // Ensure all other function calls will wait + // Ensure all other function calls will wait. c.mu.Unlock() routes, neighbors, vrfs := func() ([]route.Information, frr.BGPVrfSummary, []frr.VrfVniSpec) { return c.getRoutes(), c.getBGPNeighbors(), c.getVrfs() }() go func(routes []route.Information, neighbors frr.BGPVrfSummary, vrfs []frr.VrfVniSpec) { c.mu.Lock() - // unlock is done after return using defer + // unlock is done after return using defer. defer c.wg.Done() c.updateChannels(vrfs, routes, neighbors) }(routes, neighbors, vrfs) diff --git a/pkg/monitoring/nl.go b/pkg/monitoring/nl.go index 8a140e6d..078b59f9 100644 --- a/pkg/monitoring/nl.go +++ b/pkg/monitoring/nl.go @@ -93,14 +93,14 @@ func (c *netlinkCollector) Update(ch chan<- prometheus.Metric) error { if len(c.channels) == 1 { c.wg = sync.WaitGroup{} c.wg.Add(1) - // Ensure all other function calls will wait + // Ensure all other function calls will wait. c.mu.Unlock() routes, neighbors := func() ([]route.Information, []nl.NeighborInformation) { return c.getRoutes(), c.getNeighbors() }() go func(routes []route.Information, neighbors []nl.NeighborInformation) { c.mu.Lock() - // unlock is done after return using defer + // unlock is done after return using defer. defer c.wg.Done() c.updateChannels(neighbors, routes) }(routes, neighbors)