Rate limit 0 effectively disables rate limiting

This commit is contained in:
Lorenzo Bolla
2021-10-08 14:30:47 +02:00
parent 4c54f967b7
commit 235e35a2f3

View File

@@ -123,7 +123,9 @@ func (d *GrabDownloader) download(ctx context.Context, url string, destination s
d.log("Error creating new request: %v\n", err)
return errors.Wrap(err, url)
}
req.RateLimiter = rate.NewLimiter(rate.Limit(d.downLimit), int(d.downLimit))
if d.downLimit > 0 {
req.RateLimiter = rate.NewLimiter(rate.Limit(d.downLimit), int(d.downLimit))
}
d.maybeSetupChecksum(req, expected)
if err != nil {