-
Notifications
You must be signed in to change notification settings - Fork 20
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
RateLimiter rate type does not match TocketBucketGroup rate #14
Comments
If I may also ask at the same time, I am curious if you have a general recommendation / experience on the maximum number of buckets you would generally recommend this solution for? Thanks for this great library! |
thanks @tarmath. The |
I still think it's safer to keep it as is, somebody might change or remove the |
Regarding the number of buckets: the only limit I can think of is system resources. The bucket map only contains buckets that are not full, so under normal conditions it should be empty. I did some stress tests a while ago and the impact on throughput seemed to be negilible. I've been using this lib in production with multiple |
It does seem a bit strange to keep it a mix of Float and Double rather than consolidate on one (no matter which), but happy to close this issue regardless as that's not something that would cause issues in this context anyhow... |
(assuming you were waiting for me to close it) |
just noticed, similarly: Bucket size is Int, but consume returns a Long... |
bucket size seems to be Long, too:
What am I missing here? |
Right, but when creating these through RateLimiter, size is Int and rate is Float: yet the only thing these 2 arguments do, is be passed to the TockenBucketGroup... |
As a sidenote, I am currently returning in the response headers the limit and number of remaining tokens, somewhat mimicking github's v3 APIs as documented here: https://developer.github.com/v3/rate_limit/#response In order for me to return the limit (aka bucket size), I currently have to hold that value somewhere else since it is not exposed by the RateLimiter / TocketBucketGroup. Simply declaring size as val would be enough to make this work. Perhaps something you might be interested in changing? Thank you again! |
right, the RateLimiter should use Declaring size as Are you interested in making a PR? |
I already would have, but my hands are tied unfortunately... |
ok, done, I changed |
oh great! fantastic! much appreciated! 🙏 |
can these changes be released? |
releasing to maven central is quite a hassle, I'll see what I can do next week. |
RateLimiter's rate is a Float, while that of TocketBucketGroup is a Double.
Since RateLimiter's rate is only used to create the TokenBucketGroup, it should likely be a Double as well...?
The text was updated successfully, but these errors were encountered: