Run a generator function in parallel N times.
$ npm install co-thread
Send requests in batches of 20
:
var thread = require('co-thread');
var get = require('co-request');
var co = require('co');
co(function *(){
var times = 10;
while (times--) {
yield thread(function *(){
var a = yield get('http://google.com');
console.log(a.statusCode);
var b = yield get('http://yahoo.com');
console.log(b.statusCode);
}, 20);
}
})();
MIT