diff --git a/internal/watch/no_mx.go b/internal/watch/no_mx.go index 6c9539a6..4f4cd708 100644 --- a/internal/watch/no_mx.go +++ b/internal/watch/no_mx.go @@ -112,6 +112,7 @@ func (n *nodeMxWatcher) Run() { for { select { case <-n.doneChan: + close(n.eventChan) return case <-time.After(nodeMXRefresh): list, err := c.MetricsV1beta1().NodeMetricses().List(metav1.ListOptions{}) @@ -127,7 +128,6 @@ func (n *nodeMxWatcher) Run() { func (n *nodeMxWatcher) Stop() { log.Debug().Msg("Stopping NodeMetrix informer!") close(n.doneChan) - close(n.eventChan) } // ResultChan retrieves event channel. diff --git a/internal/watch/pod_mx.go b/internal/watch/pod_mx.go index 2d9d7b51..03a30262 100644 --- a/internal/watch/pod_mx.go +++ b/internal/watch/pod_mx.go @@ -124,6 +124,7 @@ func (p *podMxWatcher) Run() { for { select { case <-p.doneChan: + close(p.eventChan) return case <-time.After(podMXRefresh): list, err := c.MetricsV1beta1().PodMetricses(p.ns).List(metav1.ListOptions{}) @@ -173,7 +174,6 @@ func (p *podMxWatcher) update(list *mv1beta1.PodMetricsList, notify bool) { func (p *podMxWatcher) Stop() { log.Debug().Msg("Stopping PodMetrix informer!!") close(p.doneChan) - close(p.eventChan) } // ResultChan retrieves event channel.