wallet-core: fix computation of timestamp for exchange update
This commit is contained in:
parent
afaeefb943
commit
02bbf08283
@ -539,6 +539,10 @@ export interface ExchangeRecord {
|
|||||||
*/
|
*/
|
||||||
nextRefreshCheck: Timestamp;
|
nextRefreshCheck: Timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Last error (if any) for fetching updated information about the
|
||||||
|
* exchange.
|
||||||
|
*/
|
||||||
lastError?: TalerErrorDetails;
|
lastError?: TalerErrorDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,10 +52,18 @@ async function gatherExchangePending(
|
|||||||
resp: PendingOperationsResponse,
|
resp: PendingOperationsResponse,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await tx.exchanges.iter().forEachAsync(async (e) => {
|
await tx.exchanges.iter().forEachAsync(async (e) => {
|
||||||
|
let exchangeUpdateTimestampDue: Timestamp;
|
||||||
|
|
||||||
|
if (e.lastError) {
|
||||||
|
exchangeUpdateTimestampDue = e.retryInfo.nextRetry;
|
||||||
|
} else {
|
||||||
|
exchangeUpdateTimestampDue = e.nextUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
resp.pendingOperations.push({
|
resp.pendingOperations.push({
|
||||||
type: PendingTaskType.ExchangeUpdate,
|
type: PendingTaskType.ExchangeUpdate,
|
||||||
givesLifeness: false,
|
givesLifeness: false,
|
||||||
timestampDue: e.nextUpdate,
|
timestampDue: exchangeUpdateTimestampDue,
|
||||||
exchangeBaseUrl: e.baseUrl,
|
exchangeBaseUrl: e.baseUrl,
|
||||||
lastError: e.lastError,
|
lastError: e.lastError,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user