From 74fcd99c8d3dcbc1d1ac3086dce0a9ed0e07c519 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 5 Mar 2024 00:08:39 +0100 Subject: taler-wallet-cli: don't run task loop before init --- packages/taler-wallet-core/src/shepherd.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages/taler-wallet-core/src/shepherd.ts') diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts index 6f2b2fa44..db090c352 100644 --- 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 { + private async loadTasksFromDb(): Promise { 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) { -- cgit v1.2.3