Answer the question
In order to leave comments, you need to log in
NodeJS - How to make a cyclic then on Promise () - make requests in batches of 5 pieces?
Can you please explain how to write request queues without recursion if you use promises? I'm completely confused. I post my code, and I don’t understand where to insert the time delay correctly.
do {
current_partnums = partnums.splice(0, limit);
Promise.all(ps).then((function (current_partnums) {
ps = current_partnums.map(function (partnum) {
// get google results for each part
return getGooglePartResults(partnum)
// after search parse pages
.then(function (part) {
return parseGooglePartResults(part);
});
});
}).bind(null, current_partnums));
} while (partnums.length);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question