aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-06-01 19:47:52 -0500
committermat <github@matdoes.dev>2021-06-01 19:47:52 -0500
commit3370adde90bdddc0fd8848d1bfff111bca6701a2 (patch)
treefd0d5af7a72aeb001b7baf44f0772b02da34cc36 /build
parent4d7552c19f85de7137457fd443b05dc9eb7d1e6c (diff)
downloadskyblock-api-3370adde90bdddc0fd8848d1bfff111bca6701a2.tar.gz
skyblock-api-3370adde90bdddc0fd8848d1bfff111bca6701a2.tar.bz2
skyblock-api-3370adde90bdddc0fd8848d1bfff111bca6701a2.zip
fix not choosing best api key
Diffstat (limited to 'build')
-rw-r--r--build/hypixelApi.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index 59a798c..7c1176e 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -81,12 +81,12 @@ async function sendApiRequest({ path, key, args }) {
await new Promise((resolve) => setTimeout(resolve, 30000));
return await sendApiRequest({ path, key, args });
}
- if (fetchResponse.headers['ratelimit-limit'])
+ if (fetchResponse.headers.get('ratelimit-limit'))
// remember how many uses it has
apiKeyUsage[key] = {
- remaining: fetchResponse.headers['ratelimit-remaining'],
- limit: fetchResponse.headers['ratelimit-limit'],
- reset: Date.now() + parseInt(fetchResponse.headers['ratelimit-reset']) * 1000
+ remaining: parseInt(fetchResponse.headers.get('ratelimit-remaining')),
+ limit: parseInt(fetchResponse.headers.get('ratelimit-limit')),
+ reset: Date.now() + parseInt(fetchResponse.headers.get('ratelimit-reset')) * 1000
};
if (fetchJsonParsed.throttle) {
if (apiKeyUsage[key])