Use promise.all for multiple promise

pull/57/head
MillenniumEarl 2020-11-30 14:01:16 +01:00
parent dd5cc14d31
commit 1ef347ab27
1 changed files with 2 additions and 7 deletions

View File

@ -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