Skip to content

Commit 2af50c1

Browse files
committed
pkg/daemon: Drop unnecessary select from runLoginMonitor
Code is from ec135ee (daemon: Exec journalctl rather than using library, 2019-03-15, #545), and while it was not wrong, the wrapping 'select' isn't necessary for blocking on a single channel read. I only noticed because I'm working through a SIGQUIT stack trace which included: goroutine 53 [select (no cases), 814 minutes]: github.com/openshift/machine-config-operator/pkg/daemon.(*Daemon).runLoginMonitor(0xc000582a80, 0x0, 0xc000538480) /go/src/github.com/openshift/machine-config-operator/pkg/daemon/daemon.go:689 +0x30f created by github.com/openshift/machine-config-operator/pkg/daemon.(*Daemon).ClusterConnect /go/src/github.com/openshift/machine-config-operator/pkg/daemon/daemon.go:299 +0x578 So with this commit, we drop the 'select' and get straight into the blocking channel read.
1 parent c71a551 commit 2af50c1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pkg/daemon/daemon.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,9 @@ func (dn *Daemon) runLoginMonitor(stopCh <-chan struct{}, exitCh chan<- error) {
685685
}
686686
}
687687
}()
688-
select {
689-
case <-stopCh:
690-
close(worker)
691-
cmd.Process.Kill()
692-
}
688+
<-stopCh
689+
close(worker)
690+
cmd.Process.Kill()
693691
}
694692

695693
func (dn *Daemon) applySSHAccessedAnnotation() error {

0 commit comments

Comments
 (0)