Skip to content

Instantly share code, notes, and snippets.

@jcleveley-zz
Created July 21, 2011 17:48
Show Gist options
  • Save jcleveley-zz/1097744 to your computer and use it in GitHub Desktop.
Save jcleveley-zz/1097744 to your computer and use it in GitHub Desktop.
Are these parallel requests?
var request = require('request');
var factory = function(info) {
return function (error, response, body) {
if(response && response.statusCode === 200){
var obj = JSON.parse(body);
console.log(info.id, obj.likes);
} else {
console.log('error: '+ error);
}
}
};
for (var i = 0; i<100; i++){
request.get({
uri: 'http://graph.facebook.com/18311355911',
}, factory({id: i})
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment