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:
Kubernetes Prow Robot 2021-05-03 17:21:29 -07:00 committed by GitHub
commit c0a991369d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}()