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
549
549
550
550
// waitForRunnableToEnd blocks until all runnables ended or the
551
551
// 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 ) {
553
553
// Cancel leader election only after we waited. It will os.Exit() the app for safety.
554
554
defer func () {
555
- if cm .leaderElectionCancel != nil {
555
+ if retErr == nil && cm .leaderElectionCancel != nil {
556
556
// After asking the context to be cancelled, make sure
557
557
// we wait for the leader stopped channel to be closed, otherwise
558
558
// we might encounter race conditions between this code
You can’t perform that action at this time.
0 commit comments