aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-12-08 01:52:24 +0100
committerFlorian Dold <florian@dold.me>2021-12-08 01:52:24 +0100
commit02bbf082832d6ad4f6099b2aa2e3ebf8b081350c (patch)
tree0849cd85a2945616db9529a3348a3426cca224a1
parentafaeefb9439b6aab09c8c519742e1472b283efce (diff)
wallet-core: fix computation of timestamp for exchange update
-rw-r--r--packages/taler-wallet-core/src/db.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/pending.ts10
2 files changed, 13 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 4296d0503..07e0f4b0a 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -539,6 +539,10 @@ export interface ExchangeRecord {
*/
nextRefreshCheck: Timestamp;
+ /**
+ * Last error (if any) for fetching updated information about the
+ * exchange.
+ */
lastError?: TalerErrorDetails;
/**
diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts
index a87b1c8b1..e3d22bfe6 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -52,10 +52,18 @@ async function gatherExchangePending(
resp: PendingOperationsResponse,
): Promise<void> {
await tx.exchanges.iter().forEachAsync(async (e) => {
+ let exchangeUpdateTimestampDue: Timestamp;
+
+ if (e.lastError) {
+ exchangeUpdateTimestampDue = e.retryInfo.nextRetry;
+ } else {
+ exchangeUpdateTimestampDue = e.nextUpdate;
+ }
+
resp.pendingOperations.push({
type: PendingTaskType.ExchangeUpdate,
givesLifeness: false,
- timestampDue: e.nextUpdate,
+ timestampDue: exchangeUpdateTimestampDue,
exchangeBaseUrl: e.baseUrl,
lastError: e.lastError,
});