diff options
author | mat <github@matdoes.dev> | 2021-05-09 20:08:37 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-05-09 20:08:37 -0500 |
commit | 677be65237f922ec2ea0b82afcaad81a6e76e839 (patch) | |
tree | 79ebb60aafc04d22ccc2aff036f79c0d9b627119 /build/hypixelApi.js | |
parent | 58807d12eefe264e817d8dc4b7075dbb25e4c2d2 (diff) | |
download | skyblock-api-677be65237f922ec2ea0b82afcaad81a6e76e839.tar.gz skyblock-api-677be65237f922ec2ea0b82afcaad81a6e76e839.tar.bz2 skyblock-api-677be65237f922ec2ea0b82afcaad81a6e76e839.zip |
Revert "temp debug stuff"
This reverts commit 58807d12eefe264e817d8dc4b7075dbb25e4c2d2.
Diffstat (limited to 'build/hypixelApi.js')
-rw-r--r-- | build/hypixelApi.js | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js index b0d87fe..ccae09b 100644 --- a/build/hypixelApi.js +++ b/build/hypixelApi.js @@ -58,8 +58,7 @@ async function sendApiRequest({ path, key, args }) { fetchResponse = await node_fetch_1.default(fetchUrl, { agent: () => httpsAgent }); fetchJsonParsed = await fetchResponse.json(); } - catch (err) { - console.debug('error? ok retrying', err); + catch { // if there's an error, wait a second and try again await new Promise((resolve) => setTimeout(resolve, 1000)); return await sendApiRequest({ path, key, args }); @@ -77,17 +76,12 @@ async function sendApiRequest({ path, key, args }) { reset: Date.now() + parseInt(fetchResponse.headers['ratelimit-reset']) * 1000 }; if (fetchJsonParsed.throttle) { - console.log('bruh, throttled'); if (apiKeyUsage[key]) apiKeyUsage[key].remaining = 0; // if it's throttled, wait 10 seconds and try again await new Promise((resolve) => setTimeout(resolve, 10000)); return await sendApiRequest({ path, key, args }); } - console.log(path, args, fetchJsonParsed.success); - if (!fetchJsonParsed.success) { - console.log(fetchJsonParsed); - } return fetchJsonParsed; } exports.sendApiRequest = sendApiRequest; |