diff options
author | mat <github@matdoes.dev> | 2021-05-24 14:08:28 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-05-24 14:08:28 -0500 |
commit | b33fbf90a8c7df808ee88ac2b38782fcfe93f224 (patch) | |
tree | 447c4cef1ce5c4ef1ddb44f42b9e287c54d3f2f5 /src | |
parent | 17866766304a9049dda716a21d94bcd4803980a7 (diff) | |
download | skyblock-api-b33fbf90a8c7df808ee88ac2b38782fcfe93f224.tar.gz skyblock-api-b33fbf90a8c7df808ee88ac2b38782fcfe93f224.tar.bz2 skyblock-api-b33fbf90a8c7df808ee88ac2b38782fcfe93f224.zip |
enable raw leaderboard cache again
Diffstat (limited to 'src')
-rw-r--r-- | src/database.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/database.ts b/src/database.ts index c317be7..6d44b81 100644 --- a/src/database.ts +++ b/src/database.ts @@ -228,7 +228,6 @@ function isLeaderboardReversed(name: string): boolean { } async function fetchMemberLeaderboardRaw(name: string): Promise<DatabaseMemberLeaderboardItem[]> { - return [] if (!client) throw Error('Client isn\'t initialized yet') if (cachedRawLeaderboards.has(name)) @@ -251,7 +250,6 @@ async function fetchMemberLeaderboardRaw(name: string): Promise<DatabaseMemberLe } async function fetchProfileLeaderboardRaw(name: string): Promise<DatabaseProfileLeaderboardItem[]> { - 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 @@ -286,12 +284,12 @@ interface ProfileLeaderboard { /** Fetch a leaderboard that ranks members, as opposed to profiles */ export async function fetchMemberLeaderboard(name: string): Promise<MemberLeaderboard> { + 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<MemberLeaderboardItem> => { return { @@ -649,10 +647,10 @@ async function fetchAllLeaderboards(fast?: boolean): Promise<void> { 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) }) } |