cleanup: use plain channel send or receive instead of single-case select

Signed-off-by: wangyx1992 <wang.yixiang@zte.com.cn>
This commit is contained in:
wangyx1992 2021-04-23 11:17:12 +08:00
parent 1ceddc790d
commit 31d449bf57

View File

@ -138,19 +138,18 @@ func (bus *DBusCon) MonitorShutdown() (<-chan bool, error) {
go func() { go func() {
for { for {
select { event := <-busChan
case event := <-busChan: if event == nil || len(event.Body) == 0 {
if event == nil || len(event.Body) == 0 { klog.ErrorS(nil, "Failed obtaining shutdown event, PrepareForShutdown event was empty")
klog.ErrorS(nil, "Failed obtaining shutdown event, PrepareForShutdown event was empty") continue
continue
}
shutdownActive, ok := event.Body[0].(bool)
if !ok {
klog.ErrorS(nil, "Failed obtaining shutdown event, PrepareForShutdown event was not bool type as expected")
continue
}
shutdownChan <- shutdownActive
} }
shutdownActive, ok := event.Body[0].(bool)
if !ok {
klog.ErrorS(nil, "Failed obtaining shutdown event, PrepareForShutdown event was not bool type as expected")
continue
}
shutdownChan <- shutdownActive
} }
}() }()