From f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 27 May 2021 20:29:30 -0500 Subject: random random debug things and optimize leaderboards optimize leaderboards by fetching all the raw ones at the beginning --- src/database.ts | 6 +++++- src/discord.ts | 1 - src/hypixelApi.ts | 1 - src/index.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/database.ts b/src/database.ts index 7129d2b..bb3bf3a 100644 --- a/src/database.ts +++ b/src/database.ts @@ -637,8 +637,12 @@ async function fetchAllLeaderboards(fast?: boolean): Promise { const leaderboards: string[] = await fetchAllMemberLeaderboardAttributes() if (debug) console.debug('Caching raw leaderboards!') + + const promises: Promise[] = [] + for (const leaderboard of 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 (debug) console.debug('Caching leaderboards!') diff --git a/src/discord.ts b/src/discord.ts index 41f4c6e..48146b5 100644 --- a/src/discord.ts +++ b/src/discord.ts @@ -37,7 +37,6 @@ export async function exchangeCode(redirectUri: string, code: string): Promise httpsAgent } diff --git a/src/index.ts b/src/index.ts index 0937e4e..176b73f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,7 @@ import express from 'express' const app = express() -export const debug = false +export const debug = true const mainSiteUrl = 'https://skyblock.matdoes.dev' -- cgit