aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/database.js8
-rw-r--r--build/hypixelApi.js1
-rw-r--r--src/database.ts8
-rw-r--r--src/hypixelApi.ts1
4 files changed, 14 insertions, 4 deletions
diff --git a/build/database.js b/build/database.js
index d228057..55c86eb 100644
--- a/build/database.js
+++ b/build/database.js
@@ -504,15 +504,19 @@ async function removeBadMemberLeaderboardAttributes() {
/** Fetch all the leaderboards, used for caching. Don't call this often! */
async function fetchAllLeaderboards(fast) {
const leaderboards = await fetchAllMemberLeaderboardAttributes();
+ if (_1.debug)
+ console.debug('Caching raw leaderboards!');
+ for (const leaderboard of util_1.shuffle(leaderboards))
+ await fetchMemberLeaderboardRaw(leaderboard);
// shuffle so if the application is restarting many times itll still be useful
if (_1.debug)
console.debug('Caching leaderboards!');
for (const leaderboard of util_1.shuffle(leaderboards)) {
if (!fast)
// wait 2 seconds so it doesnt use as much ram
- await util_1.sleep(2 * 1000);
+ await util_1.sleep(10 * 1000);
else
- await util_1.sleep(500);
+ await util_1.sleep(2 * 1000);
await fetchMemberLeaderboard(leaderboard);
}
if (_1.debug)
diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index 9f54ef2..15c8817 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -55,6 +55,7 @@ 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/src/database.ts b/src/database.ts
index 5801f58..7129d2b 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -636,14 +636,18 @@ async function removeBadMemberLeaderboardAttributes(): Promise<void> {
async function fetchAllLeaderboards(fast?: boolean): Promise<void> {
const leaderboards: string[] = await fetchAllMemberLeaderboardAttributes()
+ if (debug) console.debug('Caching raw leaderboards!')
+ for (const leaderboard of shuffle(leaderboards))
+ await fetchMemberLeaderboardRaw(leaderboard)
+
// shuffle so if the application is restarting many times itll still be useful
if (debug) console.debug('Caching leaderboards!')
for (const leaderboard of shuffle(leaderboards)) {
if (!fast)
// wait 2 seconds so it doesnt use as much ram
- await sleep(2 * 1000)
+ await sleep(10 * 1000)
else
- await sleep(500)
+ await sleep(2 * 1000)
await fetchMemberLeaderboard(leaderboard)
}
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts
index 72af1af..4807b2b 100644
--- a/src/hypixelApi.ts
+++ b/src/hypixelApi.ts
@@ -140,6 +140,7 @@ export async function sendApiRequest({ path, key, args }): Promise<HypixelRespon
let fetchJsonParsed: any
try {
+ console.log(fetchUrl)
fetchResponse = await fetch(
fetchUrl,
{ agent: () => httpsAgent }