diff options
author | mat <github@matdoes.dev> | 2022-02-10 19:30:36 -0600 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-02-10 19:30:36 -0600 |
commit | 7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6 (patch) | |
tree | 33cf680ac831e43e05cb3b40647a04c370b32d32 /src/hypixel.ts | |
parent | 3effd71de72aa86bfcd61e26f053ca4b7cc46416 (diff) | |
download | skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.tar.gz skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.tar.bz2 skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.zip |
fix leaderboards not loading sometimes, hopefully
Diffstat (limited to 'src/hypixel.ts')
-rw-r--r-- | src/hypixel.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts index dd9d91d..745e036 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -22,6 +22,7 @@ import { cleanSkyblockProfilesResponse } from './cleaners/skyblock/profiles.js' import { CleanPlayer, cleanPlayerResponse } from './cleaners/player.js' import * as cached from './hypixelCached.js' import { debug } from './index.js' +import { sleep } from './util.js' import { WithId } from 'mongodb' export type Included = 'profiles' | 'player' | 'stats' | 'inventories' | undefined @@ -48,7 +49,7 @@ export async function sendCleanApiRequest({ path, args }, included?: Included[], const rawResponse = await sendApiRequest({ path, key, args }) if (rawResponse.throttled) { // if it's throttled, wait a second and try again - await new Promise(resolve => setTimeout(resolve, 1000)) + await sleep(1000) return await sendCleanApiRequest({ path, args }, included, options) } // clean the response |