From 3daa4dbb3fc5199fb05d58b40c0d7c9ee287595e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 20 Feb 2023 20:14:37 +0100 Subject: wallet-core: fix retryTransaction, improve tx/op identifier parsing/construction --- .../taler-wallet-core/src/operations/pending.ts | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/pending.ts') diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index 240c7ff65..2e3a5c9dc 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -39,7 +39,7 @@ import { import { AbsoluteTime } from "@gnu-taler/taler-util"; import { InternalWalletState } from "../internal-wallet-state.js"; import { GetReadOnlyAccess } from "../util/query.js"; -import { RetryTags } from "../util/retries.js"; +import { TaskIdentifiers } from "../util/retries.js"; import { GlobalIDB } from "@gnu-taler/idb-bridge"; function getPendingCommon( @@ -74,7 +74,7 @@ async function gatherExchangePending( ): Promise { // FIXME: We should do a range query here based on the update time. await tx.exchanges.iter().forEachAsync(async (exch) => { - const opTag = RetryTags.forExchangeUpdate(exch); + const opTag = TaskIdentifiers.forExchangeUpdate(exch); let opr = await tx.operationRetries.get(opTag); const timestampDue = opr?.retryInfo.nextRetry ?? AbsoluteTime.fromTimestamp(exch.nextUpdate); @@ -120,7 +120,7 @@ async function gatherRefreshPending( if (r.timestampFinished) { return; } - const opId = RetryTags.forRefresh(r); + const opId = TaskIdentifiers.forRefresh(r); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); @@ -158,7 +158,7 @@ async function gatherWithdrawalPending( if (wsr.timestampFinish) { return; } - const opTag = RetryTags.forWithdrawal(wsr); + const opTag = TaskIdentifiers.forWithdrawal(wsr); let opr = await tx.operationRetries.get(opTag); const now = AbsoluteTime.now(); if (!opr) { @@ -208,7 +208,7 @@ async function gatherDepositPending( deposited = false; } } - const opId = RetryTags.forDeposit(dg); + const opId = TaskIdentifiers.forDeposit(dg); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); resp.pendingOperations.push({ @@ -239,7 +239,7 @@ async function gatherTipPending( if (tip.pickedUpTimestamp) { return; } - const opId = RetryTags.forTipPickup(tip); + const opId = TaskIdentifiers.forTipPickup(tip); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); if (tip.acceptedTimestamp) { @@ -272,7 +272,7 @@ async function gatherPurchasePending( await tx.purchases.indexes.byStatus .iter(keyRange) .forEachAsync(async (pr) => { - const opId = RetryTags.forPay(pr); + const opId = TaskIdentifiers.forPay(pr); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); @@ -301,7 +301,7 @@ async function gatherRecoupPending( if (rg.timestampFinished) { return; } - const opId = RetryTags.forRecoup(rg); + const opId = TaskIdentifiers.forRecoup(rg); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); resp.pendingOperations.push({ @@ -325,7 +325,7 @@ async function gatherBackupPending( resp: PendingOperationsResponse, ): Promise { await tx.backupProviders.iter().forEachAsync(async (bp) => { - const opId = RetryTags.forBackup(bp); + const opId = TaskIdentifiers.forBackup(bp); const retryRecord = await tx.operationRetries.get(opId); if (bp.state.tag === BackupProviderStateTag.Ready) { const timestampDue = AbsoluteTime.fromTimestamp( @@ -366,7 +366,7 @@ async function gatherPeerPullInitiationPending( if (pi.status === OperationStatus.Finished) { return; } - const opId = RetryTags.forPeerPullPaymentInitiation(pi); + const opId = TaskIdentifiers.forPeerPullPaymentInitiation(pi); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); resp.pendingOperations.push({ @@ -392,7 +392,7 @@ async function gatherPeerPullDebitPending( if (pi.status === PeerPullPaymentIncomingStatus.Paid) { return; } - const opId = RetryTags.forPeerPullPaymentDebit(pi); + const opId = TaskIdentifiers.forPeerPullPaymentDebit(pi); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); resp.pendingOperations.push({ @@ -418,7 +418,7 @@ async function gatherPeerPushInitiationPending( if (pi.status === PeerPushPaymentInitiationStatus.PurseCreated) { return; } - const opId = RetryTags.forPeerPushPaymentInitiation(pi); + const opId = TaskIdentifiers.forPeerPushPaymentInitiation(pi); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); resp.pendingOperations.push({ @@ -447,7 +447,7 @@ async function gatherPeerPushCreditPending( case PeerPushPaymentIncomingStatus.WithdrawalCreated: return; } - const opId = RetryTags.forPeerPushCredit(pi); + const opId = TaskIdentifiers.forPeerPushCredit(pi); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); resp.pendingOperations.push({ -- cgit v1.2.3