fix(leaderelection): nil check in OnStoppedLeading func

This commit is contained in:
googs1025 2024-10-04 00:21:42 +08:00
parent d99d3f7eb7
commit b60cef2609

View File

@ -50,7 +50,9 @@ func RunWithLeaderElection(ctx context.Context, config *rest.Config, newRunnerFn
run(ctx, 1)
},
OnStoppedLeading: func() {
cancel()
if cancel != nil {
cancel()
}
},
}