mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +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() {
|
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
|
||||||
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user