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

Zero warm-up Guava RateLimiter #1946

Open
kristofarkas opened this issue Oct 28, 2021 · 0 comments
Open

Zero warm-up Guava RateLimiter #1946

kristofarkas opened this issue Oct 28, 2021 · 0 comments

Comments

@kristofarkas
Copy link

kristofarkas commented Oct 28, 2021

What happened?

The default Guava RateLimiter initializer creates a rate limiter with 0 permits, and starts acquiring them. This causes an unexpected behaviour, where at the beginning of the rate limiters lifetime the rate limit is much lower that specified.

// rate limits way more aggressively than `permitsPerSecond` at start
RateLimiter.create(permitsPerSecond)

What did you want to happen?

Setting the warm up time to zero means that max permits are available at start.

RateLimiter.create(permitsPerSecond, Duration.ZERO)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant