SGrondin / bottleneck

Job scheduler and rate limiter, supports Clustering
MIT License
1.82k stars 75 forks source link

Listener for current reservoir's value when it's altered #137

Open gomorizsolt opened 4 years ago

gomorizsolt commented 4 years ago

We're throttling the requests to adapt to the server's policies. Our goal is to display the remaining requests and inform our users in case they've exceeded the limit. Instead of calling currentReservoir(), it'd be useful to provide a listener which returns the current reservoir's value when it's altered(both directions, i.e. either it increments or decrements). It's also a weight off our shoulders because we're no longer dependent on calling currentReservoir() manually.

What's your opinion on this idea?