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