aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-05-28 22:11:24 -0500
committermat <github@matdoes.dev>2021-05-28 22:11:24 -0500
commit4ab2f45ff3767c3deb4b79cfc343f492941847b0 (patch)
tree25b70a885cab99faf3db84b228abc7e27ecb9005 /build
parente16599d7a2691b482034d40505eff435f400e5f6 (diff)
downloadskyblock-api-4ab2f45ff3767c3deb4b79cfc343f492941847b0.tar.gz
skyblock-api-4ab2f45ff3767c3deb4b79cfc343f492941847b0.tar.bz2
skyblock-api-4ab2f45ff3767c3deb4b79cfc343f492941847b0.zip
add more useful stuff to index
Diffstat (limited to 'build')
-rw-r--r--build/database.js6
-rw-r--r--build/index.js4
2 files changed, 8 insertions, 2 deletions
diff --git a/build/database.js b/build/database.js
index e4d7a9b..8e3beb9 100644
--- a/build/database.js
+++ b/build/database.js
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-exports.updateAccount = exports.fetchAccountFromDiscord = exports.fetchAccount = exports.fetchSession = exports.createSession = exports.queueUpdateDatabaseProfile = exports.queueUpdateDatabaseMember = exports.updateDatabaseProfile = exports.updateDatabaseMember = exports.fetchMemberLeaderboardSpots = exports.fetchLeaderboard = exports.fetchProfileLeaderboard = exports.fetchMemberLeaderboard = exports.fetchAllMemberLeaderboardAttributes = exports.fetchSlayerLeaderboards = exports.fetchAllLeaderboardsCategorized = exports.cachedRawLeaderboards = void 0;
+exports.updateAccount = exports.fetchAccountFromDiscord = exports.fetchAccount = exports.fetchSession = exports.createSession = exports.finishedCachingAllLeaderboards = exports.finishedCachingRawLeaderboards = exports.queueUpdateDatabaseProfile = exports.queueUpdateDatabaseMember = exports.updateDatabaseProfile = exports.updateDatabaseMember = exports.fetchMemberLeaderboardSpots = exports.fetchLeaderboard = exports.fetchProfileLeaderboard = exports.fetchMemberLeaderboard = exports.fetchAllMemberLeaderboardAttributes = exports.fetchSlayerLeaderboards = exports.fetchAllLeaderboardsCategorized = exports.cachedRawLeaderboards = void 0;
const stats_1 = require("./cleaners/skyblock/stats");
const slayers_1 = require("./cleaners/skyblock/slayers");
const mongodb_1 = require("mongodb");
@@ -523,6 +523,8 @@ async function removeBadMemberLeaderboardAttributes() {
}
}
}
+exports.finishedCachingRawLeaderboards = false;
+exports.finishedCachingAllLeaderboards = false;
/** Fetch all the leaderboards, used for caching. Don't call this often! */
async function fetchAllLeaderboards(fast) {
const leaderboards = await fetchAllMemberLeaderboardAttributes();
@@ -530,6 +532,7 @@ async function fetchAllLeaderboards(fast) {
console.debug('Caching raw leaderboards!');
for (const leaderboard of util_1.shuffle(leaderboards))
await fetchMemberLeaderboardRaw(leaderboard);
+ exports.finishedCachingRawLeaderboards = true;
// shuffle so if the application is restarting many times itll still be useful
if (_1.debug)
console.debug('Caching leaderboards!');
@@ -541,6 +544,7 @@ async function fetchAllLeaderboards(fast) {
await util_1.sleep(2 * 1000);
await fetchMemberLeaderboard(leaderboard);
}
+ exports.finishedCachingAllLeaderboards = true;
if (_1.debug)
console.debug('Finished caching leaderboards!');
}
diff --git a/build/index.js b/build/index.js
index e6ecf13..4644fed 100644
--- a/build/index.js
+++ b/build/index.js
@@ -55,7 +55,9 @@ app.get('/', async (req, res) => {
const currentTime = Date.now();
res.json({
ok: true,
- uptimeHours: (currentTime - startTime) / 1000 / 60 / 60
+ uptimeHours: (currentTime - startTime) / 1000 / 60 / 60,
+ finishedCachingRawLeaderboards: database_1.finishedCachingRawLeaderboards,
+ finishedCachingAllLeaderboards: database_1.finishedCachingAllLeaderboards
});
});
app.get('/player/:user', async (req, res) => {