fix a client-go crash handler not working issue.

This commit is contained in:
RainbowMango 2020-05-29 14:41:27 +08:00
parent c8ceeed698
commit 4a4d1947b0

View File

@ -195,10 +195,11 @@ type LeaderElector struct {
// Run starts the leader election loop
func (le *LeaderElector) Run(ctx context.Context) {
defer runtime.HandleCrash()
defer func() {
runtime.HandleCrash()
le.config.Callbacks.OnStoppedLeading()
}()
if !le.acquire(ctx) {
return // ctx signalled done
}