From 234cebd7404c9c31f4d660aad9391231b37dd04a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 10 Apr 2024 14:29:12 +0200 Subject: clear all caches when clearing DB --- packages/taler-wallet-core/src/wallet.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index d8361c6e4..2666e6eb7 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -1208,9 +1208,11 @@ async function dispatchRequestInternal( case WalletApiOperation.TestCrypto: { return await wex.cryptoApi.hashString({ str: "hello world" }); } - case WalletApiOperation.ClearDb: + case WalletApiOperation.ClearDb: { + wex.ws.clearAllCaches(); await clearDatabase(wex.db.idbHandle()); return {}; + } case WalletApiOperation.Recycle: { throw Error("not implemented"); return {}; @@ -1757,6 +1759,12 @@ export class InternalWalletState { clientCancellationMap: Map = new Map(); + clearAllCaches(): void { + this.exchangeCache.clear(); + this.denomInfoCache.clear(); + this.refreshCostCache.clear(); + } + initWithConfig(newConfig: WalletRunConfig): void { this._config = newConfig; -- cgit v1.2.3