From 893252df6eaaf602519de5d29406ce55f07b8607 Mon Sep 17 00:00:00 2001 From: YZ775 Date: Fri, 26 Apr 2024 08:15:12 +0000 Subject: [PATCH] fixup! DrainBackOffCount --- op/reboot.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 {