Merge pull request #91561 from RainbowMango/pr_fix_invalid_recover

fix a client-go crash handler not working issue.
This commit is contained in:
Kubernetes Prow Robot 2020-05-29 18:17:53 -07:00 committed by GitHub
commit 99df02cd4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}