I have an array like this:
var subscriptions = ['sub_1234', 'sub_5678', 'sub_8493'];
In my real application the array usually has about 800 subscription ids.
Currently I have a loop like this:
var subscriptionData = [];
for(var i in subscriptions) {
subscriptionID = subscriptions[i];
var data = await stripe.subscriptions.retrieve(subscriptionID);
subscriptionData.push(data);
}
The purpose of the loop is to extrapolate the subscription ids to find out all of the information related to that id (payment amounts, invoices, etc.)
The problem is with 600 subscriptions it can take 20-30 minutes to go through all of that data.
Is there away to run the for loop in parallel so that it pulls all of the stripe subscriptions at once and pushes the data onto the array? Then continues?
I was looking at this library: https://github.com/caolan/async
But I couldn't figure out how to get it to do it if you don't know how long the array is (the array can be of variable length)