chia7712 commented on code in PR #811:
URL: https://github.com/apache/yunikorn-k8shim/pull/811#discussion_r1546708687


##########
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:
   ```go
        go func() {
                defer close(stopWait)
                getDispatcher().stopped.Wait()
        }()
   ```



-- 
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]

Reply via email to