mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #101400 from wangyx1992/fix-single-case-select
cleanup: use plain channel send or receive instead of single-case select
This commit is contained in:
commit
c0a991369d
@ -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