aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-05-18 15:57:10 -0300
committerSebastian <sebasjm@gmail.com>2022-05-18 15:57:10 -0300
commit5595e942b44135e11af85d6a4e633239a3a8997f (patch)
treeff2773d2f29290fc1819f766315b87c6a3f24dfd /packages
parent145714b335be7896501afe21cb8c7419c1e9cb83 (diff)
fix: update retry info before return
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/operations/backup/index.ts1
-rw-r--r--packages/taler-wallet-core/src/operations/deposits.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts22
6 files changed, 11 insertions, 26 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts b/packages/taler-wallet-core/src/operations/backup/index.ts
index 69ba1ddbc..45b8491df 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -245,6 +245,7 @@ async function runBackupCycleForProvider(
ws: InternalWalletState,
args: BackupForProviderArgs,
): Promise<void> {
+
const provider = await ws.db
.mktx((x) => ({ backupProviders: x.backupProviders }))
.runReadOnly(async (tx) => {
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts
index 27460849a..41f051cb3 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -149,6 +149,8 @@ async function processDepositGroupImpl(
} = {},
): Promise<void> {
const forceNow = options.forceNow ?? false;
+ await setupDepositGroupRetry(ws, depositGroupId, { resetRetry: forceNow });
+
const depositGroup = await ws.db
.mktx((x) => ({
depositGroups: x.depositGroups,
@@ -165,8 +167,6 @@ async function processDepositGroupImpl(
return;
}
- await setupDepositGroupRetry(ws, depositGroupId, { resetRetry: forceNow });
-
const contractData = extractContractData(
depositGroup.contractTermsRaw,
depositGroup.contractTermsHash,
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index b10505b27..007dad685 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -556,6 +556,8 @@ async function updateExchangeFromUrlImpl(
}> {
const forceNow = options.forceNow ?? false;
logger.info(`updating exchange info for ${baseUrl}, forced: ${forceNow}`);
+ await setupExchangeUpdateRetry(ws, baseUrl, { reset: forceNow });
+
const now = AbsoluteTime.now();
baseUrl = canonicalizeBaseUrl(baseUrl);
@@ -574,8 +576,6 @@ async function updateExchangeFromUrlImpl(
return { exchange, exchangeDetails };
}
- await setupExchangeUpdateRetry(ws, baseUrl, { reset: forceNow });
-
logger.info("updating exchange /keys info");
const timeout = getExchangeRequestTimeout();
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index ceba7ef8c..ef81d117a 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -672,6 +672,8 @@ async function processDownloadProposalImpl(
} = {},
): Promise<void> {
const forceNow = options.forceNow ?? false;
+ await setupProposalRetry(ws, proposalId, { reset: forceNow });
+
const proposal = await ws.db
.mktx((x) => ({ proposals: x.proposals }))
.runReadOnly(async (tx) => {
@@ -686,8 +688,6 @@ async function processDownloadProposalImpl(
return;
}
- await setupProposalRetry(ws, proposalId, { reset: forceNow });
-
const orderClaimUrl = new URL(
`orders/${proposal.orderId}/claim`,
proposal.merchantBaseUrl,
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index ce8fd003a..0dfcef427 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -1022,6 +1022,8 @@ export async function autoRefresh(
exchangeBaseUrl: string,
): Promise<void> {
logger.info(`doing auto-refresh check for '${exchangeBaseUrl}'`);
+
+ //updateExchangeFromUrl will also update retryInfo for this operation
await updateExchangeFromUrl(ws, exchangeBaseUrl, {
forceNow: true,
});
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index da7673f35..9ca1ccb5a 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -205,23 +205,6 @@ export async function processTip(
);
}
-async function resetTipRetry(
- ws: InternalWalletState,
- tipId: string,
-): Promise<void> {
- await ws.db
- .mktx((x) => ({
- tips: x.tips,
- }))
- .runReadWrite(async (tx) => {
- const x = await tx.tips.get(tipId);
- if (x) {
- x.retryInfo = RetryInfo.reset();
- await tx.tips.put(x);
- }
- });
-}
-
async function processTipImpl(
ws: InternalWalletState,
walletTipId: string,
@@ -230,9 +213,8 @@ async function processTipImpl(
} = {},
): Promise<void> {
const forceNow = options.forceNow ?? false;
- if (forceNow) {
- await resetTipRetry(ws, walletTipId);
- }
+ await setupTipRetry(ws, walletTipId, { reset: forceNow });
+
const tipRecord = await ws.db
.mktx((x) => ({
tips: x.tips,