diff options
author | Florian Dold <florian@dold.me> | 2022-01-13 22:01:14 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-01-13 22:01:14 +0100 |
commit | 17c3ced6488eb14a01b39f1ad724fcfcd5d0c4e7 (patch) | |
tree | 66c0bc42d33f93cc185a0fd16648fa54c6cf003f /packages/taler-wallet-core/src/wallet.ts | |
parent | cd2473e1ade13ca43d8f6fafaa2e8d3c3675bfd8 (diff) | |
download | wallet-core-17c3ced6488eb14a01b39f1ad724fcfcd5d0c4e7.tar.xz |
make more use of the denom cache
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index c5eb0e65c..347a1eb03 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -626,6 +626,7 @@ async function setCoinSuspended( */ async function dumpCoins(ws: InternalWalletState): Promise<CoinDumpJson> { const coinsJson: CoinDumpJson = { coins: [] }; + logger.info("dumping coins"); await ws.db .mktx((x) => ({ coins: x.coins, @@ -1206,9 +1207,15 @@ class InternalWalletStateImpl implements InternalWalletState { const key = `${exchangeBaseUrl}:${denomPubHash}`; const cached = this.denomCache[key]; if (cached) { + logger.info("using cached denom"); return cached; } - return await tx.denominations.get([exchangeBaseUrl, denomPubHash]); + logger.info("looking up denom denom"); + const d = await tx.denominations.get([exchangeBaseUrl, denomPubHash]); + if (d) { + this.denomCache[key] = d; + } + return d; } notify(n: WalletNotification): void { |