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 @@ -557,10 +557,10 @@ func (cm *controllerManager) engageStopProcedure(stopComplete <-chan struct{}) e
557557
558558// waitForRunnableToEnd blocks until all runnables ended or the
559559// tearDownTimeout was reached. In the latter case, an error is returned.
560- func (cm * controllerManager ) waitForRunnableToEnd (shutdownCancel context.CancelFunc ) error {
560+ func (cm * controllerManager ) waitForRunnableToEnd (shutdownCancel context.CancelFunc ) ( retErr error ) {
561561 // Cancel leader election only after we waited. It will os.Exit() the app for safety.
562562 defer func () {
563- if cm .leaderElectionCancel != nil {
563+ if retErr == nil && cm .leaderElectionCancel != nil {
564564 // After asking the context to be cancelled, make sure
565565 // we wait for the leader stopped channel to be closed, otherwise
566566 // we might encounter race conditions between this code
You can’t perform that action at this time.
0 commit comments