mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-10 13:44:27 +08:00
optimising promises, reduced await use
This commit is contained in:
parent
374a2089c3
commit
6752b6086a
1 changed files with 6 additions and 6 deletions
|
@ -266,8 +266,10 @@ class ResultController {
|
|||
let tagPbs = [];
|
||||
|
||||
if (!result.bailedOut) {
|
||||
isPb = await UserDAO.checkIfPb(uid, result);
|
||||
tagPbs = await UserDAO.checkIfTagPb(uid, result);
|
||||
[isPb, tagPbs] = await Promise.all([
|
||||
UserDAO.checkIfPb(uid, user, result),
|
||||
UserDAO.checkIfTagPb(uid, user, result),
|
||||
]);
|
||||
}
|
||||
|
||||
if (isPb) {
|
||||
|
@ -293,10 +295,8 @@ class ResultController {
|
|||
afk = 0;
|
||||
}
|
||||
tt = result.testDuration + result.incompleteTestSeconds - afk;
|
||||
|
||||
await UserDAO.updateTypingStats(uid, result.restartCount, tt);
|
||||
|
||||
await PublicStatsDAO.updateStats(result.restartCount, tt);
|
||||
UserDAO.updateTypingStats(uid, result.restartCount, tt);
|
||||
PublicStatsDAO.updateStats(result.restartCount, tt);
|
||||
|
||||
if (result.bailedOut === false) delete result.bailedOut;
|
||||
if (result.blindMode === false) delete result.blindMode;
|
||||
|
|
Loading…
Reference in a new issue