commit 4c006659a6f3dfe39be7ec0a0b67a66ed384cd7a
parent 0b7caf3909fa13a0a5e789d5fadeb4d886615a67
Author: Florian Dold <florian@dold.me>
Date: Wed, 26 Jun 2024 16:30:05 +0200
wallet-core: restart all tasks also when network becomes unavailable
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
@@ -292,7 +292,7 @@ import {
getTransactions,
getWithdrawalTransactionByUri,
parseTransactionIdentifier,
- restartAll,
+ restartAll as restartAllRunningTasks,
resumeTransaction,
retryAll,
retryTransaction,
@@ -1248,12 +1248,11 @@ async function dispatchRequestInternal(
case WalletApiOperation.HintNetworkAvailability: {
const req = codecForHintNetworkAvailabilityRequest().decode(payload);
wex.ws.networkAvailable = req.isNetworkAvailable;
- if (req.isNetworkAvailable) {
- await restartAll(wex);
- } else {
- // We're not doing anything right now, but we could stop showing
- // certain errors!
- }
+ // When network becomes available, restart tasks as they're blocked
+ // waiting for the network.
+ // When network goes down, restart tasks so they notice the network
+ // is down and wait.
+ await restartAllRunningTasks(wex);
return {};
}
case WalletApiOperation.ConvertDepositAmount: {