From 7fa239e3a0c2a27bb4619bb104284e430ae613fd Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 24 May 2021 14:23:17 -0500 Subject: Revert "enable raw leaderboard cache again" This reverts commit b33fbf90a8c7df808ee88ac2b38782fcfe93f224. --- src/database.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/database.ts b/src/database.ts index 6d44b81..c317be7 100644 --- a/src/database.ts +++ b/src/database.ts @@ -228,6 +228,7 @@ function isLeaderboardReversed(name: string): boolean { } async function fetchMemberLeaderboardRaw(name: string): Promise { + return [] if (!client) throw Error('Client isn\'t initialized yet') if (cachedRawLeaderboards.has(name)) @@ -250,6 +251,7 @@ async function fetchMemberLeaderboardRaw(name: string): Promise { + return [] if (cachedRawLeaderboards.has(name)) return cachedRawLeaderboards.get(name) as DatabaseProfileLeaderboardItem[] // typescript forces us to make a new variable and set it this way because it gives an error otherwise @@ -284,12 +286,12 @@ interface ProfileLeaderboard { /** Fetch a leaderboard that ranks members, as opposed to profiles */ export async function fetchMemberLeaderboard(name: string): Promise { - const leaderboardRaw = await fetchMemberLeaderboardRaw(name) return { list: [], name: 'Leaderboards are temporarily disabled, they\'ll be back in a few hours', unit: '' } + const leaderboardRaw = await fetchMemberLeaderboardRaw(name) const fetchLeaderboardPlayer = async(item: DatabaseMemberLeaderboardItem): Promise => { return { @@ -647,10 +649,10 @@ async function fetchAllLeaderboards(fast?: boolean): Promise { if (!globalThis.isTest) { connect().then(() => { // when it connects, cache the leaderboards and remove bad members - removeBadMemberLeaderboardAttributes() + // removeBadMemberLeaderboardAttributes() // cache leaderboards on startup so its faster later on - fetchAllLeaderboards(true) + // fetchAllLeaderboards(true) // cache leaderboard players again every 4 hours - setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000) + // setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000) }) } -- cgit