aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-28 01:44:11 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-28 01:44:11 -0600
commit8db5f9e913a4db45b258ecc84f0eb4c1fc27828c (patch)
treeaf71adc60827cf1dc4da881c42f67dc8d1af7b25 /src/cleaners/skyblock
parentbf794f2564888e2a4bffa141065c321650488029 (diff)
downloadskyblock-api-8db5f9e913a4db45b258ecc84f0eb4c1fc27828c.tar.gz
skyblock-api-8db5f9e913a4db45b258ecc84f0eb4c1fc27828c.tar.bz2
skyblock-api-8db5f9e913a4db45b258ecc84f0eb4c1fc27828c.zip
slight optimization
fetch all profiles at once instead of one at a time in cleanSkyblockProfilesResponse
Diffstat (limited to 'src/cleaners/skyblock')
-rw-r--r--src/cleaners/skyblock/profiles.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cleaners/skyblock/profiles.ts b/src/cleaners/skyblock/profiles.ts
index c9f5628..f12b5f6 100644
--- a/src/cleaners/skyblock/profiles.ts
+++ b/src/cleaners/skyblock/profiles.ts
@@ -14,11 +14,11 @@ export function cleanPlayerSkyblockProfiles(rawProfiles: HypixelPlayerStatsSkyBl
/** Convert an array of raw profiles into clean profiles */
export async function cleanSkyblockProfilesResponse(data: any[]): Promise<CleanProfile[]> {
- const cleanedProfiles: CleanProfile[] = []
+ const promises = []
for (const profile of data ?? []) {
// let cleanedProfile = await cleanSkyblockProfileResponseLighter(profile)
- let cleanedProfile = await cleanSkyblockProfileResponse(profile)
- cleanedProfiles.push(cleanedProfile)
+ promises.push(cleanSkyblockProfileResponse(profile))
}
+ const cleanedProfiles: CleanProfile[] = await Promise.all(promises)
return cleanedProfiles
}