diff options
author | Florian Dold <florian@dold.me> | 2021-06-11 11:15:08 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-11 11:15:08 +0200 |
commit | e77510106fdcb0448af809fd6c928f1ff80b6d15 (patch) | |
tree | 7aeb34586b4ae86d578090da296de0050e723328 /packages/taler-wallet-core/src/operations | |
parent | 8ad36d89f55783c34043ee9ef37759cd94bcec7c (diff) | |
download | wallet-core-e77510106fdcb0448af809fd6c928f1ff80b6d15.tar.xz |
simplify retry timeout handling
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
9 files changed, 11 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 996e8cf39..23cc435ff 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -123,7 +123,7 @@ async function resetDepositGroupRetry( })) .runReadWrite(async (tx) => { const x = await tx.depositGroups.get(depositGroupId); - if (x && x.retryInfo.active) { + if (x) { x.retryInfo = initRetryInfo(); await tx.depositGroups.put(x); } diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index cbb92dc86..39adad70e 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -555,7 +555,7 @@ async function resetDownloadProposalRetry( .mktx((x) => ({ proposals: x.proposals })) .runReadWrite(async (tx) => { const p = await tx.proposals.get(proposalId); - if (p && p.retryInfo.active) { + if (p) { p.retryInfo = initRetryInfo(); await tx.proposals.put(p); } @@ -574,7 +574,7 @@ async function failProposalPermanently( if (!p) { return; } - p.retryInfo.active = false; + delete p.retryInfo; p.lastError = err; p.proposalStatus = ProposalStatus.PERMANENTLY_FAILED; await tx.proposals.put(p); diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index b40c33c5c..f0c9c9d8c 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -155,10 +155,11 @@ async function gatherProposalPending( if (proposal.proposalStatus == ProposalStatus.PROPOSED) { // Nothing to do, user needs to choose. } else if (proposal.proposalStatus == ProposalStatus.DOWNLOADING) { + const timestampDue = proposal.retryInfo?.nextRetry ?? getTimestampNow(); resp.pendingOperations.push({ type: PendingOperationType.ProposalDownload, givesLifeness: true, - timestampDue: proposal.retryInfo.nextRetry, + timestampDue, merchantBaseUrl: proposal.merchantBaseUrl, orderId: proposal.orderId, proposalId: proposal.proposalId, diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts index 7dac7faf4..24ac828f3 100644 --- a/packages/taler-wallet-core/src/operations/recoup.ts +++ b/packages/taler-wallet-core/src/operations/recoup.ts @@ -316,7 +316,7 @@ async function resetRecoupGroupRetry( })) .runReadWrite(async (tx) => { const x = await tx.recoupGroups.get(recoupGroupId); - if (x && x.retryInfo.active) { + if (x) { x.retryInfo = initRetryInfo(); await tx.recoupGroups.put(x); } diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index 21c92c1b7..0b0eb4c4a 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -656,7 +656,7 @@ async function resetRefreshGroupRetry( })) .runReadWrite(async (tx) => { const x = await tx.refreshGroups.get(refreshGroupId); - if (x && x.retryInfo.active) { + if (x) { x.retryInfo = initRetryInfo(); await tx.refreshGroups.put(x); } diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts index ba0674f06..b3d368afa 100644 --- a/packages/taler-wallet-core/src/operations/refund.ts +++ b/packages/taler-wallet-core/src/operations/refund.ts @@ -589,7 +589,7 @@ async function resetPurchaseQueryRefundRetry( })) .runReadWrite(async (tx) => { const x = await tx.purchases.get(proposalId); - if (x && x.refundStatusRetryInfo.active) { + if (x) { x.refundStatusRetryInfo = initRetryInfo(); await tx.purchases.put(x); } diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts index 6f531820c..998fbf3e0 100644 --- a/packages/taler-wallet-core/src/operations/reserves.ts +++ b/packages/taler-wallet-core/src/operations/reserves.ts @@ -85,7 +85,7 @@ async function resetReserveRetry( })) .runReadWrite(async (tx) => { const x = await tx.reserves.get(reservePub); - if (x && x.retryInfo.active) { + if (x) { x.retryInfo = initRetryInfo(); await tx.reserves.put(x); } diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index e9659248d..b96a8fcef 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -208,7 +208,7 @@ async function resetTipRetry( })) .runReadWrite(async (tx) => { const x = await tx.tips.get(tipId); - if (x && x.retryInfo.active) { + if (x) { x.retryInfo = initRetryInfo(); await tx.tips.put(x); } diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 1266a3b0f..9f5c225fc 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -790,7 +790,7 @@ async function resetWithdrawalGroupRetry( .mktx((x) => ({ withdrawalGroups: x.withdrawalGroups })) .runReadWrite(async (tx) => { const x = await tx.withdrawalGroups.get(withdrawalGroupId); - if (x && x.retryInfo.active) { + if (x) { x.retryInfo = initRetryInfo(); await tx.withdrawalGroups.put(x); } |