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

Add support to fire callback immediately when rate limiting #3

Closed stiang closed 11 years ago

stiang commented 11 years ago

This module was perfect for my needs, except I need to alert the client that rate limiting is in effect instead of just delaying the callback, so I added support for this in the RateLimiter. It simply fires the callback with remainingRequests set to -1, so that the fact that rate limiting is in effect can be easily detected from within the callback.

I also took the liberty of adding javascript code wrappers when updating the README.

jhurliman commented 11 years ago

Thanks!