Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added floating point limit support #60

merged 1 commit into from Feb 5, 2018

added floating point limit support #60

merged 1 commit into from Feb 5, 2018


Copy link

@anopheles anopheles commented Jan 26, 2018

here's my pull request, note that this is a breaking change, since the limiter now assumes a float64 instead of a int64 (a version bump might be inplace :))

func NewLimiter(max int64, tbOptions *limiter.ExpirableOptions) *limiter.Limiter {
return limiter.New(tbOptions).SetMax(max).SetBurst(int(max))
func NewLimiter(max float64, tbOptions *limiter.ExpirableOptions) *limiter.Limiter {
return limiter.New(tbOptions).SetMax(max).SetBurst(int(math.Max(1, max)))
Copy link
Contributor Author

@anopheles anopheles Jan 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this had to be done to allow rates below 1, otherwise SetBurst(0) would always result in exceeded rate limits.

Copy link

@didip didip commented Jan 30, 2018

Thanks for the PR, I'll spend some time on the weekend to push a proper release.

@didip didip merged commit c95eaa3 into didip:master Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants