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

Improve docs about Rate Limiter Middleware #287

Merged
merged 1 commit into from Jun 15, 2023

Conversation

yagikota
Copy link
Contributor

The current document is a little bit difficult to understand the usage of middleware.NewRateLimiterMemoryStore() when its argument is float . So, I added supplemental explanation.


Why is RateLimiterMemoryStoreConfig.Rate type of rate.Limit (float64)?
Are there any case when we use float rate limit?

@aldas
Copy link
Contributor

aldas commented Jun 15, 2023

Are there any case when we use float rate limit?

I can only guess what Go-folks thought when they used float (https://pkg.go.dev/golang.org/x/time/rate#Limit). It is probably when you want to have requirements like events(requests) per minute/hour/day etc. limit of 11 events per minute normalized to events per second is 5.45... but yet again forcing these check per second would not make sense. Probably backwards compatibility sake or something

TBH: I do not know :)

@aldas aldas merged commit 1a0e754 into labstack:master Jun 15, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants