aboutsummaryrefslogtreecommitdiff
path: root/build/database.js
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-05-27 21:10:51 -0500
committermat <github@matdoes.dev>2021-05-27 21:10:51 -0500
commit65d21ebe1ead9faa2e1dc6ccad0d24e990632627 (patch)
tree1f2811547398f23353655792eaf722ccd225a9b5 /build/database.js
parentf2f18c27d2e849fdc3b2a6766dc6ab4005cde7df (diff)
downloadskyblock-api-65d21ebe1ead9faa2e1dc6ccad0d24e990632627.tar.gz
skyblock-api-65d21ebe1ead9faa2e1dc6ccad0d24e990632627.tar.bz2
skyblock-api-65d21ebe1ead9faa2e1dc6ccad0d24e990632627.zip
fix some bugs with it loading forever
Diffstat (limited to 'build/database.js')
-rw-r--r--build/database.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/build/database.js b/build/database.js
index 07ed52e..f388c8c 100644
--- a/build/database.js
+++ b/build/database.js
@@ -506,10 +506,8 @@ 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))
- promises.push(fetchMemberLeaderboardRaw(leaderboard));
- await Promise.all(promises);
+ await fetchMemberLeaderboardRaw(leaderboard);
// shuffle so if the application is restarting many times itll still be useful
if (_1.debug)
console.debug('Caching leaderboards!');
@@ -526,7 +524,7 @@ async function fetchAllLeaderboards(fast) {
}
async function createSession(refreshToken, userData) {
const sessionId = uuid_1.v4();
- await sessionsCollection.insertOne({
+ await (sessionsCollection === null || sessionsCollection === void 0 ? void 0 : sessionsCollection.insertOne({
_id: sessionId,
refresh_token: refreshToken,
discord_user: {
@@ -534,26 +532,26 @@ async function createSession(refreshToken, userData) {
name: userData.username + '#' + userData.discriminator
},
lastUpdated: new Date()
- });
+ }));
return sessionId;
}
exports.createSession = createSession;
async function fetchSession(sessionId) {
- return await sessionsCollection.findOne({ _id: sessionId });
+ return await (sessionsCollection === null || sessionsCollection === void 0 ? void 0 : sessionsCollection.findOne({ _id: sessionId }));
}
exports.fetchSession = fetchSession;
async function fetchAccount(minecraftUuid) {
- return await accountsCollection.findOne({ minecraftUuid });
+ return await (accountsCollection === null || accountsCollection === void 0 ? void 0 : accountsCollection.findOne({ minecraftUuid }));
}
exports.fetchAccount = fetchAccount;
async function fetchAccountFromDiscord(discordId) {
- return await accountsCollection.findOne({ discordId });
+ return await (accountsCollection === null || accountsCollection === void 0 ? void 0 : accountsCollection.findOne({ discordId }));
}
exports.fetchAccountFromDiscord = fetchAccountFromDiscord;
async function updateAccount(discordId, schema) {
- await accountsCollection.updateOne({
+ await (accountsCollection === null || accountsCollection === void 0 ? void 0 : accountsCollection.updateOne({
discordId
- }, { $set: schema }, { upsert: true });
+ }, { $set: schema }, { upsert: true }));
}
exports.updateAccount = updateAccount;
// make sure it's not in a test