Replace promise.all with for loop for performance reasons (#7582)

This commit is contained in:
Bernd Schoolmann 2024-01-24 19:42:37 +01:00 committed by GitHub
parent c4f19bdc6e
commit 842fa5153b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -155,7 +155,12 @@ export class EncryptServiceImplementation implements EncryptService {
return [];
}
return await Promise.all(items.map((item) => item.decrypt(key)));
// don't use promise.all because this task is not io bound
let results = [];
for (let i = 0; i < items.length; i++) {
results.push(await items[i].decrypt(key));
}
return results;
}
async hash(value: string | Uint8Array, algorithm: "sha1" | "sha256" | "sha512"): Promise<string> {