ratelimitj icon indicating copy to clipboard operation
ratelimitj copied to clipboard

Dynamically change the limits at runtime

Open priyankvashist opened this issue 5 years ago • 1 comments

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?

priyankvashist avatar Mar 26 '19 09:03 priyankvashist

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.

schmohlio avatar Jul 26 '19 14:07 schmohlio