fix race condition when switching ns.
parent
10680f993a
commit
a25be06e4d
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue