Skip to content

Commit

Permalink
clean up logic
Browse files Browse the repository at this point in the history
Signed-off-by: Chengxuan Xing <[email protected]>
  • Loading branch information
Chengxuan committed Jun 6, 2024
1 parent b96a714 commit 802321f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/ffresty/ffresty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 802321f

Please sign in to comment.