Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit 3e35f87

Browse files
authored
Merge pull request #1837 from marwatk/min-burst
Place a floor of 1 on the rate limit burst to prevent x/time from throwing an error
2 parents 793bc3c + a449e2b commit 3e35f87

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: gitlab.go

+5
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,11 @@ func (c *Client) configureLimiter(ctx context.Context, headers http.Header) {
533533
limit := rate.Limit(rateLimit * 0.66)
534534
burst := int(rateLimit * 0.33)
535535

536+
// Need at least one allowed to burst or x/time will throw an error
537+
if burst == 0 {
538+
burst = 1
539+
}
540+
536541
// Create a new limiter using the calculated values.
537542
c.limiter = rate.NewLimiter(limit, burst)
538543

0 commit comments

Comments
 (0)