diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/database.ts | 15 | ||||
-rw-r--r-- | src/index.ts | 5 |
2 files changed, 2 insertions, 18 deletions
diff --git a/src/database.ts b/src/database.ts index 3cad5b5..9e74790 100644 --- a/src/database.ts +++ b/src/database.ts @@ -677,7 +677,6 @@ async function removeBadMemberLeaderboardAttributes(): Promise<void> { } export let finishedCachingRawLeaderboards = false -export let finishedCachingAllLeaderboards = false /** Fetch all the leaderboards, used for caching. Don't call this often! */ async function fetchAllLeaderboards(fast?: boolean): Promise<void> { @@ -688,20 +687,6 @@ async function fetchAllLeaderboards(fast?: boolean): Promise<void> { for (const leaderboard of shuffle(leaderboards)) await fetchMemberLeaderboardRaw(leaderboard) finishedCachingRawLeaderboards = true - - // 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(2 * 1000) - else - await sleep(500) - - await fetchMemberLeaderboard(leaderboard) - } - finishedCachingAllLeaderboards = true - if (debug) console.debug('Finished caching leaderboards!') } export async function createSession(refreshToken: string, userData: discord.DiscordUser): Promise<string> { diff --git a/src/index.ts b/src/index.ts index 642e9b3..389a1fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { createSession, fetchAccount, fetchAccountFromDiscord, fetchAllLeaderboardsCategorized, fetchLeaderboard, fetchMemberLeaderboardSpots, fetchSession, finishedCachingAllLeaderboards, finishedCachingRawLeaderboards, updateAccount } from './database' +import { createSession, fetchAccountFromDiscord, fetchAllLeaderboardsCategorized, fetchLeaderboard, fetchMemberLeaderboardSpots, fetchSession, finishedCachingRawLeaderboards, updateAccount } from './database' import { fetchMemberProfile, fetchUser } from './hypixel' import rateLimit from 'express-rate-limit' import * as constants from './constants' @@ -36,8 +36,7 @@ app.get('/', async(req, res) => { res.json({ ok: true, uptimeHours: (currentTime - startTime) / 1000 / 60 / 60, - finishedCachingRawLeaderboards, - finishedCachingAllLeaderboards + finishedCachingRawLeaderboards }) }) |