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

RedisRateLimiterFactory should be able to work with just a connection (rather than a RedisClient) #58

Open
xenomachina opened this issue Apr 7, 2023 · 0 comments

Comments

@xenomachina
Copy link

xenomachina commented Apr 7, 2023

The RedisClient docs say:

RedisClient is an expensive resource. It holds a set of netty's EventLoopGroup's that use multiple threads. Reuse this instance as much as possible or share a ClientResources instance amongst multiple client instances.

RedisRateLimiterFactory makes it difficult to share a single RedisClient, because its close() method closes the client. (That is, it effectively "takes ownership" of the client.)

Taking a RedisClient also makes it incompatible with connection pooling, as typically one does not have visibility to the RedisClient itself outside of the pool's construction.

Given that RedisRateLimiterFactory only uses a single connection, could an additional constructor that takes a StatefulRedisConnection<String, String> be added?

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

No branches or pull requests

1 participant