jhurliman / node-rate-limiter

A generic rate limiter for node.js. Useful for API clients, web crawling, or other tasks that need to be throttled
MIT License
1.5k stars 132 forks source link

Fixed bug with stale token count #6

Closed rickhuizinga closed 11 years ago

rickhuizinga commented 11 years ago

The getTokensRemaining function was returning a stale token count.

Needs to call tokenBucket.drip() to update the token count so that it is current at the time the count was requested.

jhurliman commented 11 years ago

Good catch, thanks!

jhurliman commented 11 years ago

Just published this to npm as version 1.0.4