From 527716758f154eb863acb0052f004dd23313f765 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 May 2024 10:26:54 -0300 Subject: redo commit #aa39162de --- packages/taler-wallet-core/src/wallet.ts | 33 +++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 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 49ffbcfb6..c17a2b467 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -107,6 +107,7 @@ import { codecForGetExchangeTosRequest, codecForGetWithdrawalDetailsForAmountRequest, codecForGetWithdrawalDetailsForUri, + codecForHintNetworkAvailabilityRequest, codecForImportDbRequest, codecForInitRequest, codecForInitiatePeerPullPaymentRequest, @@ -287,6 +288,7 @@ import { getWithdrawalTransactionByUri, parseTransactionIdentifier, resumeTransaction, + retryAll, retryTransaction, suspendTransaction, } from "./transactions.js"; @@ -741,7 +743,6 @@ async function dispatchRequestInternal( innerError: getErrorDetailFromException(e), }); } - wex.ws.initWithConfig(applyRunConfigDefaults(req.config)); if (wex.ws.config.testing.skipDefaults) { @@ -754,8 +755,11 @@ async function dispatchRequestInternal( versionInfo: getVersion(wex), }; - // After initialization, task loop should run. - await wex.taskScheduler.ensureRunning(); + if (req.config?.lazyTaskLoop) { + logger.trace("lazily starting task loop"); + } else { + await wex.taskScheduler.ensureRunning(); + } wex.ws.initCalled = true; return resp; @@ -1043,6 +1047,10 @@ async function dispatchRequestInternal( const req = codecForPrepareWithdrawExchangeRequest().decode(payload); return handlePrepareWithdrawExchange(wex, req); } + case WalletApiOperation.CheckPayForTemplate: { + const req = codecForCheckPayTemplateRequest().decode(payload); + return await checkPayForTemplate(wex, req); + } case WalletApiOperation.PreparePayForUri: { const req = codecForPreparePayRequest().decode(payload); return await preparePayForUri(wex, req.talerPayUri); @@ -1231,10 +1239,16 @@ async function dispatchRequestInternal( await loadBackupRecovery(wex, req); return {}; } - // case WalletApiOperation.GetPlanForOperation: { - // const req = codecForGetPlanForOperationRequest().decode(payload); - // return await getPlanForOperation(ws, req); - // } + case WalletApiOperation.HintNetworkAvailability: { + const req = codecForHintNetworkAvailabilityRequest().decode(payload); + if (req.isNetworkAvailable) { + await retryAll(wex); + } else { + // We're not doing anything right now, but we could stop showing + // certain errors! + } + return {}; + } case WalletApiOperation.ConvertDepositAmount: { const req = codecForConvertAmountRequest.decode(payload); return await convertDepositAmount(wex, req); @@ -1829,6 +1843,11 @@ class WalletDbTriggerSpec implements TriggerSpec { if (info.mode !== "readwrite") { return; } + logger.trace( + `in after commit callback for readwrite, modified ${j2s([ + ...info.modifiedStores, + ])}`, + ); const modified = info.accessedStores; if ( modified.has(WalletStoresV1.exchanges.storeName) || -- cgit v1.2.3