aboutsummaryrefslogtreecommitdiff
path: root/build/hypixelApi.js
diff options
context:
space:
mode:
authormat-1 <github@matdoes.dev>2021-04-16 18:14:50 +0000
committermat-1 <github@matdoes.dev>2021-04-16 18:14:50 +0000
commit8c39ee0f01ccad3cfbdc8d36a3dfb189acd1c75f (patch)
tree82315e47f0f5d93634fa669adcffc7bbb4f64873 /build/hypixelApi.js
parenta89768c346be4c05d20f97c6caf0603d5f352b22 (diff)
downloadskyblock-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.js4
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;
}