diff options
author | mat <github@matdoes.dev> | 2021-05-27 20:29:30 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-05-27 20:29:30 -0500 |
commit | f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df (patch) | |
tree | 641ea6ec80309cbbccd70834b47d0c6fa769cf99 /build/database.js | |
parent | f065fd2dd0fa38870727069e0ff2382c21cfe080 (diff) | |
download | skyblock-api-f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df.tar.gz skyblock-api-f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df.tar.bz2 skyblock-api-f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df.zip |
random random debug things and optimize leaderboards
optimize leaderboards by fetching all the raw ones at the beginning
Diffstat (limited to 'build/database.js')
-rw-r--r-- | build/database.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/build/database.js b/build/database.js index 55c86eb..07ed52e 100644 --- a/build/database.js +++ b/build/database.js @@ -506,8 +506,10 @@ async function fetchAllLeaderboards(fast) { const leaderboards = await fetchAllMemberLeaderboardAttributes(); if (_1.debug) console.debug('Caching raw leaderboards!'); + const promises = []; for (const leaderboard of util_1.shuffle(leaderboards)) - await fetchMemberLeaderboardRaw(leaderboard); + promises.push(fetchMemberLeaderboardRaw(leaderboard)); + await Promise.all(promises); // shuffle so if the application is restarting many times itll still be useful if (_1.debug) console.debug('Caching leaderboards!'); |