I would like to do the following
Will the following code help me to do that?
1 - iterate though users
2- Push requests to myRequests Array
for (var i = 0; i < 1000000; i++) {
//console.log(i);
myRequests.push(function(callback) {
request.get(
"https://graph.facebook.com/v2.6/me/messages",
{
qs: {
access_token: "55"
},
json: {
recipient: {
id: users[i]
},
message: "55"
}
},
(err, res) => {
callback(null);
}
);
});
}
`
3- Set ParallelLimit to 250
async.parallelLimit(
myRequests, 250, function(err, results) {
});
`
The slowest part is most likely the request to Facebook, no matter if you use superagent, axios or something else. If you want to broadcast messages, better use the Broadcast API: