From 779cbcd58d96ddf5da889545c4f5895c16fb736e Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 10 Nov 2024 21:35:13 -0800 Subject: [PATCH] Performance test does not show a huge improvement (half a second over a million records) using Promise.all so revert to simpler implementation. --- src/lib/wallet.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/lib/wallet.ts b/src/lib/wallet.ts index 32242cb..3ed559d 100644 --- a/src/lib/wallet.ts +++ b/src/lib/wallet.ts @@ -72,17 +72,11 @@ abstract class Wallet { from = to to = swap } - const accountQueue = [] for (let i = from; i <= to; i++) { if (this.#accounts[i] == null) { - accountQueue.push(new Promise(resolve => { - this.ckd(i).then(account => this.#accounts[i] = account).then(resolve) - })) + this.#accounts[i] = await this.ckd(i) } } - if (accountQueue.length > 0) { - await Promise.allSettled(accountQueue) - } return this.#accounts.slice(from, to + 1) } -- 2.34.1