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

Dynamically change the limits at runtime #28

Open
priyankvashist opened this issue Mar 26, 2019 · 1 comment
Open

Dynamically change the limits at runtime #28

priyankvashist opened this issue Mar 26, 2019 · 1 comment

Comments

@priyankvashist
Copy link

I was using this library(Redis module) and really wanted to use it to dynamically rate limit APIs at runtime. But looking at the code it appears like limit rule is bound to instance created by the factory. So to make it to work dynamically, I need to create a new instance with new limit rule.
Is my understanding correct or is there a way to change limit rule on the instance already created?

@schmohlio
Copy link

My understanding is that while more strenuous on the garbage collector, you can create new objects via the factory when the configuration changes.

I would recommend storing some synchronized RequestRateLimiters in a client class, and only creating new objects when a separate monitoring thread receives a change.

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

2 participants