wallet-core: fix computation of timestamp for exchange update

This commit is contained in:
Florian Dold 2021-12-08 01:52:24 +01:00
parent afaeefb943
commit 02bbf08283
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 13 additions and 1 deletions

View File

@ -539,6 +539,10 @@ export interface ExchangeRecord {
*/
nextRefreshCheck: Timestamp;
/**
* Last error (if any) for fetching updated information about the
* exchange.
*/
lastError?: TalerErrorDetails;
/**

View File

@ -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,
});