aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/taler-util/src/wallet-types.ts12
-rw-r--r--packages/taler-wallet-cli/src/index.ts7
-rw-r--r--packages/taler-wallet-core/src/wallet.ts4
3 files changed, 16 insertions, 7 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 4f971319a..4e2e08a8b 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -487,6 +487,7 @@ export interface PartialWalletRunConfig {
builtin?: Partial<WalletRunConfig["builtin"]>;
testing?: Partial<WalletRunConfig["testing"]>;
features?: Partial<WalletRunConfig["features"]>;
+ lazyTaskLoop?: Partial<WalletRunConfig["lazyTaskLoop"]>;
}
export interface WalletRunConfig {
@@ -520,8 +521,17 @@ export interface WalletRunConfig {
*/
features: {
allowHttp: boolean;
- lazyTaskLoop: boolean;
};
+
+ /**
+ * Start processing tasks only when explicitly required, even after
+ * init has been called.
+ *
+ * Useful when the wallet is started to make single read-only request,
+ * as otherwise wallet-core starts making network request and process
+ * unrelated pending tasks.
+ */
+ lazyTaskLoop: boolean;
}
export interface InitRequest {
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index a55b6bd32..a1b008f5e 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -29,6 +29,7 @@ import {
encodeCrock,
getErrorDetailFromException,
getRandomBytes,
+ InitRequest,
j2s,
Logger,
NotificationType,
@@ -284,9 +285,7 @@ async function createLocalWallet(
"native-init",
{
config: {
- features: {
- lazyTaskLoop: args.lazyTaskLoop,
- },
+ lazyTaskLoop: args.lazyTaskLoop,
testing: {
devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"),
denomselAllowLate: checkEnvFlag(
@@ -296,7 +295,7 @@ async function createLocalWallet(
skipDefaults: walletCliArgs.wallet.skipDefaults,
},
},
- },
+ } satisfies InitRequest,
);
return res;
} catch (e) {
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index b4a22c398..9262904b5 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -756,7 +756,7 @@ async function dispatchRequestInternal(
versionInfo: getVersion(wex),
};
- if (req.config?.features?.lazyTaskLoop) {
+ if (req.config?.lazyTaskLoop) {
logger.trace("lazily starting task loop");
} else {
await wex.taskScheduler.ensureRunning();
@@ -1720,7 +1720,6 @@ export function applyRunConfigDefaults(
},
features: {
allowHttp: wcp?.features?.allowHttp ?? false,
- lazyTaskLoop: false,
},
testing: {
denomselAllowLate: wcp?.testing?.denomselAllowLate ?? false,
@@ -1730,6 +1729,7 @@ export function applyRunConfigDefaults(
skipDefaults: wcp?.testing?.skipDefaults ?? false,
emitObservabilityEvents: wcp?.testing?.emitObservabilityEvents ?? false,
},
+ lazyTaskLoop: wcp?.lazyTaskLoop ?? false,
};
}