Skip to content

Commit 4a4ebc7

Browse files
committed
avoid log channel closed caused endless loop
1 parent 2a07254 commit 4a4ebc7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/systemlogmonitor/log_monitor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ func (l *logMonitor) monitorLoop() {
129129
l.initializeStatus()
130130
for {
131131
select {
132-
case log := <-l.logCh:
132+
case log, ok := <-l.logCh:
133+
if !ok {
134+
glog.Errorf("Log channel closed")
135+
return
136+
}
133137
l.parseLog(log)
134138
case <-l.tomb.Stopping():
135139
l.watcher.Stop()

0 commit comments

Comments
 (0)