From f6ec105b72ab5b79b934b8a4c1626b019c31c4a2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 13 Jan 2022 01:31:53 -0300 Subject: fixing high cpu usage after some time retryinfo was not being updated and not being used by exchangeCheckRefresh pending operation --- packages/taler-wallet-core/src/operations/pending.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/pending.ts') diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index 99d275836..b2f13625a 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -51,25 +51,18 @@ async function gatherExchangePending( resp: PendingOperationsResponse, ): Promise { 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: exchangeUpdateTimestampDue, + timestampDue: e.lastError ? e.retryInfo.nextRetry : e.nextUpdate, exchangeBaseUrl: e.baseUrl, lastError: e.lastError, }); resp.pendingOperations.push({ type: PendingTaskType.ExchangeCheckRefresh, - timestampDue: e.nextRefreshCheck, + timestampDue: e.lastError ? e.retryInfo.nextRetry : e.nextRefreshCheck, givesLifeness: false, exchangeBaseUrl: e.baseUrl, }); -- cgit v1.2.3