ratelimitj
ratelimitj copied to clipboard
Dynamically change the limits at runtime
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?
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 RequestRateLimiter
s in a client class, and only creating new objects when a separate monitoring thread receives a change.