Properly close channel when monitor exits.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-10-25 14:11:39 -07:00
parent 705cb01e0c
commit be7cc78aa0
9 changed files with 37 additions and 14 deletions
@@ -128,7 +128,11 @@ func (c *customPluginMonitor) monitorLoop() {
for {
select {
case result := <-resultChan:
case result, ok := <-resultChan:
if !ok {
glog.Errorf("Result channel closed: %s", c.configPath)
return
}
glog.V(3).Infof("Receive new plugin result for %s: %+v", c.configPath, result)
status := c.generateStatus(result)
glog.Infof("New status generated: %+v", status)