From 802321f20359f16c1158cceec20a60a6ba1ca0d6 Mon Sep 17 00:00:00 2001 From: Chengxuan Xing Date: Thu, 6 Jun 2024 14:59:42 +0100 Subject: [PATCH] clean up logic Signed-off-by: Chengxuan Xing --- pkg/ffresty/ffresty.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/ffresty/ffresty.go b/pkg/ffresty/ffresty.go index 96bad3c..4ecef4e 100644 --- a/pkg/ffresty/ffresty.go +++ b/pkg/ffresty/ffresty.go @@ -177,12 +177,9 @@ func New(ctx context.Context, staticConfig config.Section) (client *resty.Client } func getRateLimiter(rps, burst int) *rate.Limiter { - if rps != 0 || burst != 0 { // if neither was set, no need for a rate limiter + if rps != 0 { // if rps is not set no need for a rate limiter rpsLimiter := rate.Limit(rps) - if rps == 0 { // only want to control max concurrent requests - rpsLimiter = rate.Inf - } - if rps != 0 && burst == 0 { + if burst == 0 { burst = rps } return rate.NewLimiter(rpsLimiter, burst)