File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -549,10 +549,10 @@ func (cm *controllerManager) engageStopProcedure(stopComplete <-chan struct{}) e
549549
550550// waitForRunnableToEnd blocks until all runnables ended or the 
551551// tearDownTimeout was reached. In the latter case, an error is returned. 
552- func  (cm  * controllerManager ) waitForRunnableToEnd (shutdownCancel  context.CancelFunc ) error  {
552+ func  (cm  * controllerManager ) waitForRunnableToEnd (shutdownCancel  context.CancelFunc ) ( retErr   error )  {
553553// Cancel leader election only after we waited. It will os.Exit() the app for safety. 
554554defer  func () {
555- if  cm .leaderElectionCancel  !=  nil  {
555+ if  retErr   ==   nil   &&   cm .leaderElectionCancel  !=  nil  {
556556// After asking the context to be cancelled, make sure 
557557// we wait for the leader stopped channel to be closed, otherwise 
558558// we might encounter race conditions between this code 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments