diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-14 20:27:42 -0500 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-14 20:27:42 -0500 |
commit | 52907cf2056cd434dad7270475fc9e4a532c04fa (patch) | |
tree | ed4f185f5d9c36161c3b759c8616a2c7818c58dc /src/hypixelCached.ts | |
parent | 0e5887326f1ba1f8005ca0bd217c5b332a1fb6cf (diff) | |
download | skyblock-api-52907cf2056cd434dad7270475fc9e4a532c04fa.tar.gz skyblock-api-52907cf2056cd434dad7270475fc9e4a532c04fa.tar.bz2 skyblock-api-52907cf2056cd434dad7270475fc9e4a532c04fa.zip |
Revert "Total leaderboards leaderboard (#5)"
This reverts commit 0e5887326f1ba1f8005ca0bd217c5b332a1fb6cf.
Diffstat (limited to 'src/hypixelCached.ts')
-rw-r--r-- | src/hypixelCached.ts | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts index 3dc89a3..c347a1a 100644 --- a/src/hypixelCached.ts +++ b/src/hypixelCached.ts @@ -143,32 +143,18 @@ export async function usernameFromUser(user: string): Promise<string> { return username } -let fetchingPlayers: Set<string> = new Set() export async function fetchPlayer(user: string): Promise<CleanPlayer> { const playerUuid = await uuidFromUser(user) - if (playerCache.has(playerUuid)) return playerCache.get(playerUuid) - // if it's already in the process of fetching, check every 100ms until it's not fetching the player anymore and fetch it again, since it'll be cached now - if (fetchingPlayers.has(playerUuid)) { - while (fetchingPlayers.has(playerUuid)) { - await new Promise(resolve => setTimeout(resolve, 100)) - } - return await fetchPlayer(user) - } - - fetchingPlayers.add(playerUuid) - const cleanPlayer: CleanPlayer = await hypixel.sendCleanApiRequest({ path: 'player', args: { uuid: playerUuid } }) - fetchingPlayers.delete(playerUuid) - if (!cleanPlayer) return // clone in case it gets modified somehow later |