I am facing a situation where I have multiple requests to make, but they cannot all be called simultaneously. Therefore, I came up with a solution to split the set of requests into chunks of 10. I'm curious about how I can handle making these 10 requests and waiting for all of them to complete, as shown in the example below:
data = []
for(mindex = 0; mindex < 1000; mindex = mindex + 10){
request_chunk = []
for(index = mindex+1; index < mindex+10; index++){
request_chunk.push(api.call(requests[index]).getPromise();
}
data = data + waitPromiseToComplete(request_chunk);
}