mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-27 15:39:39 +00:00
fix a client-go crash handler not working issue.
Kubernetes-commit: 4a4d1947b031aa301be6046c641faae275f5223b
This commit is contained in:
parent
7530c5eab3
commit
78a7be5457
@ -195,10 +195,11 @@ type LeaderElector struct {
|
|||||||
|
|
||||||
// Run starts the leader election loop
|
// Run starts the leader election loop
|
||||||
func (le *LeaderElector) Run(ctx context.Context) {
|
func (le *LeaderElector) Run(ctx context.Context) {
|
||||||
|
defer runtime.HandleCrash()
|
||||||
defer func() {
|
defer func() {
|
||||||
runtime.HandleCrash()
|
|
||||||
le.config.Callbacks.OnStoppedLeading()
|
le.config.Callbacks.OnStoppedLeading()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if !le.acquire(ctx) {
|
if !le.acquire(ctx) {
|
||||||
return // ctx signalled done
|
return // ctx signalled done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user