Use context.TODO() to be explicit that cancellation is not implemented

Kubernetes-commit: 102090d1f12f9b00571d440470ba040e0632fbe0
This commit is contained in:
Mikhail Mazurskiy
2018-06-07 14:33:03 +10:00
committed by Kubernetes Publisher
parent ad39df114e
commit f674595347

View File

@@ -208,10 +208,9 @@ func (le *LeaderElector) renew(ctx context.Context) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
wait.Until(func() {
// PollUntil() sleeps for "interval" duration before calling the function so we need to increase the timeout by le.config.RetryPeriod
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, le.config.RetryPeriod+le.config.RenewDeadline)
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, le.config.RenewDeadline)
defer timeoutCancel()
err := wait.PollUntil(le.config.RetryPeriod, func() (bool, error) {
err := wait.PollImmediateUntil(le.config.RetryPeriod, func() (bool, error) {
return le.tryAcquireOrRenew(), nil
}, timeoutCtx.Done())
le.maybeReportTransition()