I am try to improve some performance problem and for this I am try to do followings
I have a promises array and I wanna return result of this after all promises at promises array are done.
by the way result of processA, processB and processC are important too because at // other logic I use them at somewhere.
const promiseResults = await Promise.all(promises);
const [processA, processB, processC] = await Promise.all([
asyncProcessForA(),
asyncProcessForB(),
asyncProcessForC(),
]);
// other logic
// ....
// ....
return promiseResults;
So, I wanna add promiseResults inside promise.all like
const [promiseResults, processA, processB, processC] = await Promise.all([
Promise.all(promises),
asyncProcessForA(),
asyncProcessForB(),
asyncProcessForC(),
]);
// other logic
// ....
// ....
return promiseResults;
So, Is my way is good or not and also using nested promise.all is a good way or not? Because I do some search for best practices for using nested promise.all but I could not find anything So, what do you offer ?
I haven’t use such construction, but if you don’t like it, you can wrap your promise.all in another promise, so it won’t be nested promise all.