taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 74fcd99c8d3dcbc1d1ac3086dce0a9ed0e07c519
parent 695a6a43ea143475b2dddd070a2e16680b2bc9c7
Author: Florian Dold <florian@dold.me>
Date:   Tue,  5 Mar 2024 00:08:39 +0100

taler-wallet-cli: don't run task loop before init

Diffstat:
Mpackages/taler-wallet-cli/src/index.ts | 7-------
Mpackages/taler-wallet-core/src/pay-merchant.ts | 2--
Mpackages/taler-wallet-core/src/shepherd.ts | 4+++-
3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts @@ -1223,13 +1223,6 @@ advancedCli }; const wh = await createLocalWallet(args, onNotif, args.serve.noInit); const w = wh.wallet; - w.runTaskLoop() - .then((res) => { - logger.warn("task loop exited unexpectedly"); - }) - .catch((e) => { - logger.error(`error in task loop: ${e}`); - }); let nextClientId = 1; const notifyHandlers = new Map<number, (n: WalletNotification) => void>(); w.addNotificationListener((n) => { diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -1723,8 +1723,6 @@ async function waitPaymentResult( waitSessionId?: string, ): Promise<ConfirmPayResult> { const ctx = new PayMerchantTransactionContext(wex, proposalId); - - wex.taskScheduler.ensureRunning(); wex.taskScheduler.startShepherdTask(ctx.taskId); // FIXME: Clean up using the new JS "using" / Symbol.dispose syntax. diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts @@ -162,7 +162,7 @@ export class TaskSchedulerImpl implements TaskScheduler { constructor(private ws: InternalWalletState) {} - async loadTasksFromDb(): Promise<void> { + private async loadTasksFromDb(): Promise<void> { const activeTasks = await getActiveTaskIds(this.ws); logger.info(`active tasks from DB: ${j2s(activeTasks)}`); @@ -227,6 +227,7 @@ export class TaskSchedulerImpl implements TaskScheduler { } startShepherdTask(taskId: TaskIdStr): void { + this.ensureRunning(); // Run in the background, no await! this.internalStartShepherdTask(taskId); } @@ -237,6 +238,7 @@ export class TaskSchedulerImpl implements TaskScheduler { * Mostly useful to interrupt all waits when time-travelling. */ reload() { + this.ensureRunning(); const tasksIds = [...this.sheps.keys()]; logger.info(`reloading sheperd with ${tasksIds.length} tasks`); for (const taskId of tasksIds) {