aboutsummaryrefslogtreecommitdiff
path: root/src/hypixelCached.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-02-10 19:30:36 -0600
committermat <github@matdoes.dev>2022-02-10 19:30:36 -0600
commit7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6 (patch)
tree33cf680ac831e43e05cb3b40647a04c370b32d32 /src/hypixelCached.ts
parent3effd71de72aa86bfcd61e26f053ca4b7cc46416 (diff)
downloadskyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.tar.gz
skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.tar.bz2
skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.zip
fix leaderboards not loading sometimes, hopefully
Diffstat (limited to 'src/hypixelCached.ts')
-rw-r--r--src/hypixelCached.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts
index d5b6628..b49a190 100644
--- a/src/hypixelCached.ts
+++ b/src/hypixelCached.ts
@@ -3,8 +3,8 @@
*/
import { CleanProfile, CleanFullProfile, CleanBasicProfile } from './cleaners/skyblock/profile.js'
+import { isUuid, sleep, undashUuid } from './util.js'
import { CleanPlayer } from './cleaners/player.js'
-import { isUuid, undashUuid } from './util.js'
import * as hypixel from './hypixel.js'
import * as mojang from './mojang.js'
import NodeCache from 'node-cache'
@@ -166,7 +166,7 @@ export async function fetchPlayer(user: string): Promise<CleanPlayer | null> {
// 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))
+ await sleep(100)
}
return await fetchPlayer(user)
}