diff options
author | Florian Dold <florian@dold.me> | 2024-05-27 21:19:44 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-05-27 21:19:47 +0200 |
commit | bce10929f3b51fa965ff57b61bea0cbb84426da4 (patch) | |
tree | 7f910e7f5339525ddc399535cbb0af86039eac16 /packages/taler-wallet-core | |
parent | 1623cb3656c6ffb8b4def8e038fc456fdfe21a96 (diff) | |
download | wallet-core-bce10929f3b51fa965ff57b61bea0cbb84426da4.tar.xz |
wallet-core: test-only request to reset all retries
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/transactions.ts | 5 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet-api-types.ts | 13 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 6 |
3 files changed, 21 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts index 9a9fb524f..1adfa5425 100644 --- a/packages/taler-wallet-core/src/transactions.ts +++ b/packages/taler-wallet-core/src/transactions.ts @@ -93,7 +93,6 @@ import { computeDenomLossTransactionStatus, DenomLossTransactionContext, ExchangeWireDetails, - fetchFreshExchange, getExchangeWireDetailsInTx, } from "./exchanges.js"; import { @@ -1772,7 +1771,11 @@ export async function retryTransaction( } } +/** + * Reset the task retry counter for all tasks. + */ export async function retryAll(wex: WalletExecutionContext): Promise<void> { + await wex.taskScheduler.ensureRunning(); const tasks = wex.taskScheduler.getActiveTasks(); for (const task of tasks) { await wex.taskScheduler.resetTaskRetries(task); diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts index 1bcab801c..aa88331ea 100644 --- a/packages/taler-wallet-core/src/wallet-api-types.ts +++ b/packages/taler-wallet-core/src/wallet-api-types.ts @@ -123,7 +123,6 @@ import { StartRefundQueryForUriResponse, StartRefundQueryRequest, StoredBackupList, - TalerMerchantApi, TestPayArgs, TestPayResult, TestingGetDenomStatsRequest, @@ -277,6 +276,7 @@ export enum WalletApiOperation { TestingGetDenomStats = "testingGetDenomStats", TestingPing = "testingPing", TestingGetReserveHistory = "testingGetReserveHistory", + TestingResetAllRetries = "testingResetAllRetries", } // group: Initialization @@ -1213,6 +1213,16 @@ export type TestingGetReserveHistoryOp = { }; /** + * Reset all task/transaction retries, + * resulting in immediate re-try of all operations. + */ +export type TestingResetAllRetriesOp = { + op: WalletApiOperation.TestingResetAllRetries; + request: EmptyObject; + response: EmptyObject; +}; + +/** * Get stats about an exchange denomination. */ export type TestingGetDenomStatsOp = { @@ -1356,6 +1366,7 @@ export type WalletOperations = { [WalletApiOperation.ConfirmWithdrawal]: ConfirmWithdrawalOp; [WalletApiOperation.CanonicalizeBaseUrl]: CanonicalizeBaseUrlOp; [WalletApiOperation.TestingGetReserveHistory]: TestingGetReserveHistoryOp; + [WalletApiOperation.TestingResetAllRetries]: TestingResetAllRetriesOp; [WalletApiOperation.HintNetworkAvailability]: HintNetworkAvailabilityOp; }; diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 71e8c652b..f301ca3a7 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -266,6 +266,7 @@ import { TaskScheduler, TaskSchedulerImpl, convertTaskToTransactionId, + getActiveTaskIds, listTaskForTransactionId, } from "./shepherd.js"; import { @@ -1093,7 +1094,7 @@ async function dispatchRequestInternal( return {}; } case WalletApiOperation.GetActiveTasks: { - const allTasksId = wex.taskScheduler.getActiveTasks(); + const allTasksId = (await getActiveTaskIds(wex.ws)).taskIds; const tasksInfo = await Promise.all( allTasksId.map(async (id) => { @@ -1435,6 +1436,9 @@ async function dispatchRequestInternal( await waitTasksDone(wex); return {}; } + case WalletApiOperation.TestingResetAllRetries: + await retryAll(wex); + return {}; case WalletApiOperation.RemoveGlobalCurrencyAuditor: { const req = codecForRemoveGlobalCurrencyAuditorRequest().decode(payload); await wex.db.runReadWriteTx( |