From 2031f35d9bb86e7a90315e4b64550b199c4da553 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Tue, 15 Feb 2022 11:36:17 +0100 Subject: [PATCH] Cleanup --- internal/metricRouter/metricRouter.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/metricRouter/metricRouter.go b/internal/metricRouter/metricRouter.go index e8c30cc..88f5817 100644 --- a/internal/metricRouter/metricRouter.go +++ b/internal/metricRouter/metricRouter.go @@ -263,7 +263,7 @@ func (r *metricRouter) Start() { } } - // Foward message received from receivers channel + // Forward message received from receivers channel recv_forward := func(p lp.CCMetric) { // receive from receive manager if r.config.IntervalStamp { @@ -274,7 +274,7 @@ func (r *metricRouter) Start() { } } - // Foward message received from cache channel + // Forward message received from cache channel cache_forward := func(p lp.CCMetric) { // receive from metric collector if !r.dropMetric(p) { @@ -342,13 +342,18 @@ func (r *metricRouter) Close() { r.done <- true // wait for close of channel r.done <-r.done + + // stop timer if r.config.IntervalStamp { cclog.ComponentDebug("MetricRouter", "TIMER CLOSE") r.timerdone <- true // wait for close of channel r.timerdone <-r.timerdone } + + // stop metric cache if r.config.NumCacheIntervals > 0 { + cclog.ComponentDebug("MetricRouter", "CACHE CLOSE") r.cache.Close() r.cachewg.Wait() }