You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add an optional burstable rate limiter (#1924)
The existing rate limiter was moved to a separate package and renamed to
IntervalLimiter. Added BurstLimiter which is a wrapper around the
"golang.org/x/time/rate" package.
The conf.Rate type now has a private `typ` field that indicates if it is
a `"interval"` or `"burst"` rate limiter. If the config value is in the
form of `"<burst>/<rate>"` we set it to `"burst"`, otherwise
`"interval"`. The `conf.Rate.GetRateType()` method is then called from
the `ratelimit.New` function to determine the underlying type of
`ratelimit.Limiter` it returns.
Then changed `api.NewLimiterOptions` to call `ratelimit.New` instead of
creating a specific type of rate limiter.
---------
Co-authored-by: Chris Stockton <[email protected]>
0 commit comments