From 31d449bf57508f9467673d3a7a52279ff56567ad Mon Sep 17 00:00:00 2001 From: wangyx1992 Date: Fri, 23 Apr 2021 11:17:12 +0800 Subject: [PATCH] cleanup: use plain channel send or receive instead of single-case select Signed-off-by: wangyx1992 --- .../nodeshutdown/systemd/inhibit_linux.go | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkg/kubelet/nodeshutdown/systemd/inhibit_linux.go b/pkg/kubelet/nodeshutdown/systemd/inhibit_linux.go index 432e07de558..d3c09d316f4 100644 --- a/pkg/kubelet/nodeshutdown/systemd/inhibit_linux.go +++ b/pkg/kubelet/nodeshutdown/systemd/inhibit_linux.go @@ -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 + } }()