From d0af44aefb4d4cd86ace69bc54c5a7dad40be5e5 Mon Sep 17 00:00:00 2001 From: Shuning Chen Date: Thu, 4 Jul 2024 17:18:52 +0800 Subject: [PATCH] fix Signed-off-by: Shuning Chen --- client/resource_group/controller/limiter.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/resource_group/controller/limiter.go b/client/resource_group/controller/limiter.go index 5ad34895c64a..0c164d4fc029 100644 --- a/client/resource_group/controller/limiter.go +++ b/client/resource_group/controller/limiter.go @@ -141,11 +141,11 @@ func NewLimiterWithCfg(name string, now time.Time, cfg tokenBucketReconfigureArg // A Reservation holds information about events that are permitted by a Limiter to happen after a delay. // A Reservation may be canceled, which may enable the Limiter to permit additional events. type Reservation struct { - ok bool - lim *Limiter - tokens float64 - timeToAct time.Time - needWaitDurtion time.Duration + ok bool + lim *Limiter + tokens float64 + timeToAct time.Time + needWaitDuration time.Duration // This is the Limit at reservation time, it can change later. limit Limit err error @@ -393,10 +393,10 @@ func (lim *Limiter) reserveN(now time.Time, n float64, maxFutureReserve time.Dur // Prepare reservation r := Reservation{ - ok: ok, - lim: lim, - limit: lim.limit, - needWaitDurtion: waitDuration, + ok: ok, + lim: lim, + limit: lim.limit, + needWaitDuration: waitDuration, } if ok { r.tokens = n @@ -504,7 +504,7 @@ func WaitReservations(ctx context.Context, now time.Time, reservations []*Reserv if res.err != nil { return res.needWaitDuration, res.err } - return res.needWaitDurtion, errs.ErrClientResourceGroupThrottled + return res.needWaitDuration, errs.ErrClientResourceGroupThrottled } delay := res.DelayFrom(now) if delay > longestDelayDuration {