commit 3580540e01784fe1bf331c7d29e5868b2691348e
parent 8e66c97a6b335b89e45ce0c442ffac5cee09f04c
Author: Florian Dold <florian@dold.me>
Date: Wed, 25 Mar 2026 21:25:36 +0100
wallet-core: limit db tx retries, fix bad assignment
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
@@ -2806,11 +2806,21 @@ function maybeExtractTransactionError(
return undefined;
}
+const maxDbTxRetries = 20;
+
async function handleTxRetries<T>(
wex: WalletExecutionContext,
f: () => Promise<T>,
): Promise<T> {
+ let n = 0;
while (1) {
+ if (n > 0) {
+ logger.trace(`db transaction attempt ${n}`);
+ }
+ if (n > maxDbTxRetries) {
+ throw Error("max DB retries reached, giving up");
+ }
+ n++;
wex.cancellationToken.throwIfCancelled();
try {
return await f();
@@ -2824,7 +2834,7 @@ async function handleTxRetries<T>(
url = exn.denomInfo.exchangeBaseUrl;
logger.info(`got unverified denominations, updating ${url}`);
} else if (exn instanceof OutdatedExchangeError) {
- const url = exn.exchangeBaseUrl;
+ url = exn.exchangeBaseUrl;
logger.info(`got outdated exchange entry, updating ${url}`);
}
if (url) {