caolan/async — pull request #123 by janjongboom (2012-04-25 09:53:17+00:00)
Title: Add rate limiting to queues

Often I find myself dealing with rate limited API's. This pull request adds rate limiting to async's queues so you don't have to deal with that yourself.

Usage:

```javascript
var q = async.queue(function (item, next) {
console.log(item);
next();
}, 2).rateLimit(1000);

q.drain = function () {
console.log("We're all done");
};

q.push([ 1,2,3,4,5,6,7,8,9,10 ]);
```

Just like a normal queue, only you can chain a `rateLimit` command to the queue (or invoke it via `q.rateLimit()` later on). The argument is the number of ms. minimally required to wait between consecutive requests. Ergo, for a 100/min. rate limit, use 60000/100. The feature has been built by adding a mixin to the queue when the `rateLimit` function is invoked.