Skip to content

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
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.

2 participants