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 | |
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')
-rw-r--r-- | build/constants.js | 4 | ||||
-rw-r--r-- | build/hypixelApi.js | 8 | ||||
-rw-r--r-- | build/index.js | 2 |
3 files changed, 3 insertions, 11 deletions
diff --git a/build/constants.js b/build/constants.js index b657426..3c0c7e9 100644 --- a/build/constants.js +++ b/build/constants.js @@ -64,8 +64,7 @@ async function fetchGithubApi(method, route, headers, json) { }, headers), }); } - catch (err) { - console.log('bruh, errored', err); + catch { // if there's an error, wait a second and try again await new Promise((resolve) => setTimeout(resolve, 1000)); return await fetchGithubApi(method, route, headers, json); @@ -90,7 +89,6 @@ function fetchFile(path) { 'Accept': 'application/vnd.github.v3+json', }); const data = await r.json(); - console.log('ok github api returned'); const file = { path: data.path, content: Buffer.from(data.content, data.encoding).toString(), 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; diff --git a/build/index.js b/build/index.js index ba1e21a..c7f1385 100644 --- a/build/index.js +++ b/build/index.js @@ -29,7 +29,7 @@ const express_rate_limit_1 = __importDefault(require("express-rate-limit")); const constants = __importStar(require("./constants")); const express_1 = __importDefault(require("express")); const app = express_1.default(); -exports.debug = true; +exports.debug = false; // 200 requests over 5 minutes const limiter = express_rate_limit_1.default({ windowMs: 60 * 1000 * 5, |