aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/database.js7
-rw-r--r--src/database.ts7
2 files changed, 6 insertions, 8 deletions
diff --git a/build/database.js b/build/database.js
index 69f95af..4ba2376 100644
--- a/build/database.js
+++ b/build/database.js
@@ -547,16 +547,15 @@ async function fetchAllLeaderboards(fast) {
for (const leaderboard of util_1.shuffle(leaderboards))
await fetchMemberLeaderboardRaw(leaderboard);
exports.finishedCachingRawLeaderboards = true;
- return;
// shuffle so if the application is restarting many times itll still be useful
if (_1.debug)
console.debug('Caching leaderboards!');
for (const leaderboard of util_1.shuffle(leaderboards)) {
if (!fast)
// wait 2 seconds so it doesnt use as much ram
- await util_1.sleep(10 * 1000);
- else
await util_1.sleep(2 * 1000);
+ else
+ await util_1.sleep(500);
await fetchMemberLeaderboard(leaderboard);
}
exports.finishedCachingAllLeaderboards = true;
@@ -601,7 +600,7 @@ if (!globalThis.isTest) {
// when it connects, cache the leaderboards and remove bad members
removeBadMemberLeaderboardAttributes();
// cache leaderboards on startup so its faster later on
- fetchAllLeaderboards(false);
+ fetchAllLeaderboards(true);
// cache leaderboard players again every 4 hours
setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000);
});
diff --git a/src/database.ts b/src/database.ts
index 6dc8ed4..3cad5b5 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -688,16 +688,15 @@ async function fetchAllLeaderboards(fast?: boolean): Promise<void> {
for (const leaderboard of shuffle(leaderboards))
await fetchMemberLeaderboardRaw(leaderboard)
finishedCachingRawLeaderboards = true
- return
// shuffle so if the application is restarting many times itll still be useful
if (debug) console.debug('Caching leaderboards!')
for (const leaderboard of shuffle(leaderboards)) {
if (!fast)
// wait 2 seconds so it doesnt use as much ram
- await sleep(10 * 1000)
- else
await sleep(2 * 1000)
+ else
+ await sleep(500)
await fetchMemberLeaderboard(leaderboard)
}
@@ -743,7 +742,7 @@ if (!globalThis.isTest) {
// when it connects, cache the leaderboards and remove bad members
removeBadMemberLeaderboardAttributes()
// cache leaderboards on startup so its faster later on
- fetchAllLeaderboards(false)
+ fetchAllLeaderboards(true)
// cache leaderboard players again every 4 hours
setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000)
})