aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-05-27 20:29:30 -0500
committermat <github@matdoes.dev>2021-05-27 20:29:30 -0500
commitf2f18c27d2e849fdc3b2a6766dc6ab4005cde7df (patch)
tree641ea6ec80309cbbccd70834b47d0c6fa769cf99 /build
parentf065fd2dd0fa38870727069e0ff2382c21cfe080 (diff)
downloadskyblock-api-f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df.tar.gz
skyblock-api-f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df.tar.bz2
skyblock-api-f2f18c27d2e849fdc3b2a6766dc6ab4005cde7df.zip
random random debug things and optimize leaderboards
optimize leaderboards by fetching all the raw ones at the beginning
Diffstat (limited to 'build')
-rw-r--r--build/database.js4
-rw-r--r--build/discord.js1
-rw-r--r--build/hypixelApi.js1
-rw-r--r--build/index.js2
4 files changed, 4 insertions, 4 deletions
diff --git a/build/database.js b/build/database.js
index 55c86eb..07ed52e 100644
--- a/build/database.js
+++ b/build/database.js
@@ -506,8 +506,10 @@ async function fetchAllLeaderboards(fast) {
const leaderboards = await fetchAllMemberLeaderboardAttributes();
if (_1.debug)
console.debug('Caching raw leaderboards!');
+ const promises = [];
for (const leaderboard of util_1.shuffle(leaderboards))
- await fetchMemberLeaderboardRaw(leaderboard);
+ promises.push(fetchMemberLeaderboardRaw(leaderboard));
+ await Promise.all(promises);
// shuffle so if the application is restarting many times itll still be useful
if (_1.debug)
console.debug('Caching leaderboards!');
diff --git a/build/discord.js b/build/discord.js
index be085bb..a92521a 100644
--- a/build/discord.js
+++ b/build/discord.js
@@ -21,7 +21,6 @@ async function exchangeCode(redirectUri, code) {
'redirect_uri': redirectUri,
'scope': 'identify'
};
- console.log(new URLSearchParams(data).toString());
const fetchResponse = await node_fetch_1.default(API_ENDPOINT + '/oauth2/token', {
method: 'POST',
agent: () => httpsAgent,
diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index 15c8817..9f54ef2 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -55,7 +55,6 @@ async function sendApiRequest({ path, key, args }) {
let fetchResponse;
let fetchJsonParsed;
try {
- console.log(fetchUrl);
fetchResponse = await node_fetch_1.default(fetchUrl, { agent: () => httpsAgent });
fetchJsonParsed = await fetchResponse.json();
}
diff --git a/build/index.js b/build/index.js
index 0f0b570..fb2789d 100644
--- a/build/index.js
+++ b/build/index.js
@@ -30,7 +30,7 @@ const constants = __importStar(require("./constants"));
const discord = __importStar(require("./discord"));
const express_1 = __importDefault(require("express"));
const app = express_1.default();
-exports.debug = false;
+exports.debug = true;
const mainSiteUrl = 'https://skyblock.matdoes.dev';
// 200 requests over 5 minutes
const limiter = express_rate_limit_1.default({