avoid log channel closed caused endless loop

This commit is contained in:
wenjun93
2019-10-25 11:43:49 +08:00
parent 2a07254f96
commit 4a4ebc7097

View File

@@ -129,7 +129,11 @@ func (l *logMonitor) monitorLoop() {
l.initializeStatus()
for {
select {
case log := <-l.logCh:
case log, ok := <-l.logCh:
if !ok {
glog.Errorf("Log channel closed")
return
}
l.parseLog(log)
case <-l.tomb.Stopping():
l.watcher.Stop()