We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfa5982 commit c24617cCopy full SHA for c24617c
pkg/store/leaderelection/leaderelection.go
@@ -65,7 +65,8 @@ import (
65
)
66
67
const (
68
- JitterFactor = 1.2
+ JitterFactor = 1.2
69
+ releaseTimeout = 15 * time.Second
70
71
72
// NewLeaderElector creates a LeaderElector from a LeaderElectionConfig
@@ -267,7 +268,12 @@ func (le *LeaderElector) renew(ctx context.Context) {
267
268
if le.config.ReleaseOnCancel {
269
// Use the background context, not the one that was passed in originally. If
270
// the latter was cancelled, then we can't actually do the release.
- le.release(context.Background())
271
+ releaseCtx, releaseCancel := context.WithTimeout(
272
+ context.Background(),
273
+ releaseTimeout,
274
+ )
275
+ defer releaseCancel()
276
+ le.release(releaseCtx)
277
}
278
279
0 commit comments