diff --git a/op/reboot.go b/op/reboot.go index b671eeea..01c5ed42 100644 --- a/op/reboot.go +++ b/op/reboot.go @@ -572,11 +572,11 @@ func drainBackOff(ctx context.Context, inf cke.Infrastructure, entry *cke.Reboot entry.Status = cke.RebootStatusQueued entry.LastTransitionTime = time.Now().Truncate(time.Second).UTC() entry.DrainBackOffCount++ - backoffDuration := time.Second * time.Duration((1<<(entry.DrainBackOffCount-1))*drainBackOffBaseSeconds+rand.Int63n(drainBackOffBaseSeconds)) - if backoffDuration > time.Second*drainBackOffMaxSeconds { - backoffDuration = time.Second * time.Duration(drainBackOffMaxSeconds+rand.Int63n(drainBackOffBaseSeconds)) + backoffSeconds := (1 << (entry.DrainBackOffCount - 1)) * drainBackOffBaseSeconds + if backoffSeconds > drainBackOffMaxSeconds { + backoffSeconds = drainBackOffMaxSeconds } - entry.DrainBackOffExpire = entry.LastTransitionTime.Add(backoffDuration) + entry.DrainBackOffExpire = entry.LastTransitionTime.Add(time.Second * time.Duration(backoffSeconds+rand.Intn(drainBackOffBaseSeconds))) err = inf.Storage().UpdateRebootsEntry(ctx, entry) if err != nil {