From f5d194dfc61ae0d358a27b994861dc20b83cf98e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 28 Mar 2022 23:59:16 +0200 Subject: wallet: cancellation for deposit --- packages/taler-wallet-core/src/wallet.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'packages/taler-wallet-core/src/wallet.ts') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 943051153..abd11faab 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -78,6 +78,7 @@ import { URL, WalletNotification, Duration, + CancellationToken, } from "@gnu-taler/taler-util"; import { timeStamp } from "console"; import { @@ -271,9 +272,19 @@ async function processOnePendingOperation( case PendingTaskType.ExchangeCheckRefresh: await autoRefresh(ws, pending.exchangeBaseUrl); break; - case PendingTaskType.Deposit: - await processDepositGroup(ws, pending.depositGroupId); + case PendingTaskType.Deposit: { + const cts = CancellationToken.create(); + ws.taskCancellationSourceForDeposit = cts; + try { + await processDepositGroup(ws, pending.depositGroupId, { + cancellationToken: cts.token, + }); + } finally { + cts.dispose(); + delete ws.taskCancellationSourceForDeposit; + } break; + } case PendingTaskType.Backup: await processBackupForProvider(ws, pending.backupProviderBaseUrl); break; -- cgit v1.2.3