summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-10 14:29:12 +0200
committerFlorian Dold <florian@dold.me>2024-04-10 14:29:12 +0200
commit234cebd7404c9c31f4d660aad9391231b37dd04a (patch)
treeec67845d5f123d262557920743cf21735e27911c
parent030b9f6f720f1bb42fef74fd15739499e9f1619a (diff)
downloadwallet-core-234cebd7404c9c31f4d660aad9391231b37dd04a.tar.gz
wallet-core-234cebd7404c9c31f4d660aad9391231b37dd04a.tar.bz2
wallet-core-234cebd7404c9c31f4d660aad9391231b37dd04a.zip
clear all caches when clearing DB
-rw-r--r--packages/taler-wallet-core/src/wallet.ts10
1 files changed, 9 insertions, 1 deletions
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<Op extends WalletApiOperation>(
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<string, CancellationToken.Source> = new Map();
+ clearAllCaches(): void {
+ this.exchangeCache.clear();
+ this.denomInfoCache.clear();
+ this.refreshCostCache.clear();
+ }
+
initWithConfig(newConfig: WalletRunConfig): void {
this._config = newConfig;