mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
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:
parent
1ceddc790d
commit
31d449bf57
@ -138,19 +138,18 @@ func (bus *DBusCon) MonitorShutdown() (<-chan bool, error) {
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case event := <-busChan:
|
||||
if event == nil || len(event.Body) == 0 {
|
||||
klog.ErrorS(nil, "Failed obtaining shutdown event, PrepareForShutdown event was empty")
|
||||
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
|
||||
event := <-busChan
|
||||
if event == nil || len(event.Body) == 0 {
|
||||
klog.ErrorS(nil, "Failed obtaining shutdown event, PrepareForShutdown event was empty")
|
||||
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
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user