diff options
author | Florian Dold <florian@dold.me> | 2024-06-26 16:30:05 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-06-26 16:32:40 +0200 |
commit | 4c006659a6f3dfe39be7ec0a0b67a66ed384cd7a (patch) | |
tree | 29a0d1cba61e0d62589cf5035ca5a4035282a1ed | |
parent | 0b7caf3909fa13a0a5e789d5fadeb4d886615a67 (diff) | |
download | wallet-core-4c006659a6f3dfe39be7ec0a0b67a66ed384cd7a.tar.xz |
wallet-core: restart all tasks also when network becomes unavailable
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 79a159d55..4e5fdab71 100644 --- 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: { |