aboutsummaryrefslogtreecommitdiff
path: root/build/cleaners/skyblock/profile.js
diff options
context:
space:
mode:
Diffstat (limited to 'build/cleaners/skyblock/profile.js')
-rw-r--r--build/cleaners/skyblock/profile.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js
index fe1161e..3a6bc6f 100644
--- a/build/cleaners/skyblock/profile.js
+++ b/build/cleaners/skyblock/profile.js
@@ -26,13 +26,14 @@ exports.cleanSkyblockProfileResponseLighter = cleanSkyblockProfileResponseLighte
* This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data
*/
async function cleanSkyblockProfileResponse(data, options) {
- const cleanedMembers = [];
+ // We use Promise.all so it can fetch all the users at once instead of waiting for the previous promise to complete
+ const promises = [];
for (const memberUUID in data.members) {
const memberRaw = data.members[memberUUID];
memberRaw.uuid = memberUUID;
- const member = await member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined]);
- cleanedMembers.push(member);
+ promises.push(member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined]));
}
+ const cleanedMembers = await Promise.all(promises);
const memberMinions = [];
for (const member of cleanedMembers) {
memberMinions.push(member.minions);