|
|
%!s(int64=5) %!d(string=hai) anos | |
|---|---|---|
| .. | ||
| test | %!s(int64=5) %!d(string=hai) anos | |
| .npmignore | %!s(int64=5) %!d(string=hai) anos | |
| Makefile | %!s(int64=5) %!d(string=hai) anos | |
| Readme.md | %!s(int64=5) %!d(string=hai) anos | |
| example.js | %!s(int64=5) %!d(string=hai) anos | |
| index.js | %!s(int64=5) %!d(string=hai) anos | |
| package.json | %!s(int64=5) %!d(string=hai) anos | |
Run a generator function in parallel N times.
$ npm install co-thread
Send a request in batches of 20 parallel GETs:
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 res = yield get('http://google.com');
console.log(res.statusCode);
}, 20);
}
})();
MIT