pbacsko commented on code in PR #811:
URL: https://github.com/apache/yunikorn-k8shim/pull/811#discussion_r1546852736
##########
pkg/dispatcher/dispatcher.go:
##########
@@ -257,13 +260,23 @@ func Stop() {
}
close(getDispatcher().stopChan)
- maxTimeout := 5
- for getDispatcher().isRunning() && maxTimeout > 0 {
- log.Log(log.ShimDispatcher).Info("waiting for dispatcher to be
stopped",
- zap.Int("remainingSeconds", maxTimeout))
- time.Sleep(1 * time.Second)
- maxTimeout--
+ stopWait := make(chan struct{})
+ defer close(stopWait)
+
+ go func() {
+ getDispatcher().stopped.Wait()
+ stopWait <- struct{}{}
Review Comment:
That would mean double closure, which results in a panic. Closing inside
`Stop()` (outside the goroutine) seems to be a better place to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]