diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/taler-wallet-core/src/exchanges.ts | 3 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/pay-merchant.ts | 1 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/shepherd.ts | 15 |
3 files changed, 13 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts index 626441d35..adb696de0 100644 --- a/packages/taler-wallet-core/src/exchanges.ts +++ b/packages/taler-wallet-core/src/exchanges.ts @@ -977,9 +977,7 @@ async function startUpdateExchangeEntry( wex.ws.exchangeCache.clear(); await tx.exchanges.put(r); const newExchangeState = getExchangeState(r); - // Reset retries for updating the exchange entry. const taskId = TaskIdentifiers.forExchangeUpdate(r); - await tx.operationRetries.delete(taskId); return { oldExchangeState, newExchangeState, taskId }; }, ); @@ -2239,7 +2237,6 @@ export async function markExchangeUsed( notif: undefined, }; } - logger.info(`exchange ${exch.baseUrl} IS IN THE DATABASE`); const oldExchangeState = getExchangeState(exch); switch (exch.entryStatus) { diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts index aa4919285..badbd32f4 100644 --- a/packages/taler-wallet-core/src/pay-merchant.ts +++ b/packages/taler-wallet-core/src/pay-merchant.ts @@ -342,7 +342,6 @@ export class PayMerchantTransactionContext implements TransactionContext { return; } await tx.purchases.put(purchase); - await tx.operationRetries.delete(this.taskId); const newTxState = computePayMerchantTransactionState(purchase); return { oldTxState, newTxState }; }, diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts index ee55e1da1..0f285eb39 100644 --- a/packages/taler-wallet-core/src/shepherd.ts +++ b/packages/taler-wallet-core/src/shepherd.ts @@ -432,8 +432,13 @@ export class TaskSchedulerImpl implements TaskScheduler { } case TaskRunResultType.ScheduleLater: { logger.trace(`Shepherd for ${taskId} got schedule-later result.`); - await storeTaskProgress(this.ws, taskId); - const delay = AbsoluteTime.remaining(res.runAt); + const retryRecord = await storePendingTaskPending( + this.ws, + taskId, + res.runAt, + ); + const t = timestampAbsoluteFromDb(retryRecord.retryInfo.nextRetry); + const delay = AbsoluteTime.remaining(t); logger.trace(`Waiting for ${delay.d_ms} ms`); await this.wait(taskId, info, delay); break; @@ -515,6 +520,7 @@ async function storeTaskProgress( async function storePendingTaskPending( ws: InternalWalletState, pendingTaskId: string, + schedTime?: AbsoluteTime, ): Promise<OperationRetryRecord> { logger.trace(`storing task [pending] for ${pendingTaskId}`); const res = await ws.db.runAllStoresReadWriteTx({}, async (tx) => { @@ -532,6 +538,11 @@ async function storePendingTaskPending( delete retryRecord.lastError; retryRecord.retryInfo = DbRetryInfo.increment(retryRecord.retryInfo); } + if (schedTime) { + retryRecord.retryInfo.nextRetry = timestampPreciseToDb( + AbsoluteTime.toPreciseTimestamp(schedTime), + ); + } await tx.operationRetries.put(retryRecord); let notification: WalletNotification | undefined = undefined; if (hadError) { |