Use promise.all for multiple promise
parent
dd5cc14d31
commit
1ef347ab27
|
@ -224,12 +224,7 @@ module.exports.getLatestUpdates = async function(args, limit) {
|
||||||
const urls = await latestFetch.fetchLatest(query, limit);
|
const urls = await latestFetch.fetchLatest(query, limit);
|
||||||
|
|
||||||
// Get the gamedata from urls
|
// Get the gamedata from urls
|
||||||
const gameInfoList = [];
|
const promiseList = urls.map(u => exports.getGameDataFromURL(u));
|
||||||
for(const url of urls) {
|
return await Promise.all(promiseList);
|
||||||
const gameinfo = await exports.getGameDataFromURL(url);
|
|
||||||
gameInfoList.push(gameinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gameInfoList;
|
|
||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
Loading…
Reference in New Issue