diff options
author | mat-1 <github@matdoes.dev> | 2021-04-16 18:14:50 +0000 |
---|---|---|
committer | mat-1 <github@matdoes.dev> | 2021-04-16 18:14:50 +0000 |
commit | 8c39ee0f01ccad3cfbdc8d36a3dfb189acd1c75f (patch) | |
tree | 82315e47f0f5d93634fa669adcffc7bbb4f64873 /build/hypixelApi.js | |
parent | a89768c346be4c05d20f97c6caf0603d5f352b22 (diff) | |
download | skyblock-api-8c39ee0f01ccad3cfbdc8d36a3dfb189acd1c75f.tar.gz skyblock-api-8c39ee0f01ccad3cfbdc8d36a3dfb189acd1c75f.tar.bz2 skyblock-api-8c39ee0f01ccad3cfbdc8d36a3dfb189acd1c75f.zip |
Compiled TS into JS
Diffstat (limited to 'build/hypixelApi.js')
-rw-r--r-- | build/hypixelApi.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js index 2b3a601..0656d62 100644 --- a/build/hypixelApi.js +++ b/build/hypixelApi.js @@ -71,7 +71,9 @@ async function sendApiRequest({ path, key, args }) { if (fetchJsonParsed.throttle) { if (apiKeyUsage[key]) apiKeyUsage[key].remaining = 0; - return { throttled: true }; + // if it's throttled, wait 10 seconds and try again + await new Promise((resolve) => setTimeout(resolve, 10000)); + return await sendApiRequest({ path, key, args }); } return fetchJsonParsed; } |