【发布时间】:2023-03-06 02:25:01
【问题描述】:
我用 riot api 开发我的玩具项目。(英雄联盟游戏) 我有一个问题。如您所见,我请求在 for 循环中使用 riot api。 需要 20 秒……这就是问题所在。我认为 riot api 不是问题。 我认为只是在 for 循环中请求是问题所在。 我怎样才能让它比现在更快?请帮帮我ㅠ.ㅠ
for (let cnt = 0; cnt < 20; cnt++) {
let temp = await api.getMatchInfo(res.matches[cnt].gameId);
if (temp.gameMode === "CLASSIC" && temp.gameDuration >= 800) {
console.log("gameList:", temp);
temp["cnt"] = cnt;
gameList.push(temp);
rankCnt++;
}
}
【问题讨论】:
标签: reactjs api for-loop request axios