Skip to content

Commit

Permalink
Fix the HTTP request rate limiter
Browse files Browse the repository at this point in the history
The rate limiter was initialized with a maximum of 1 request per second with a
burst size of `RateLimitPerSecond`. Because we only use the `limiter.Wait()`
API, we can fix the burst at 1.
  • Loading branch information
pietern committed Mar 26, 2021
1 parent 5a804bb commit 4a7475b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (c *DatabricksClient) configureHTTPCLient() {
if c.RateLimitPerSecond == 0 {
c.RateLimitPerSecond = DefaultRateLimitPerSecond
}
c.rateLimiter = rate.NewLimiter(rate.Every(1*time.Second), c.RateLimitPerSecond)
c.rateLimiter = rate.NewLimiter(rate.Limit(c.RateLimitPerSecond), 1)
// Set up a retryable HTTP Client to handle cases where the service returns
// a transient error on initial creation
retryDelayDuration := 10 * time.Second
Expand Down

0 comments on commit 4a7475b

Please sign in to comment.