aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-05-27 21:19:44 +0200
committerFlorian Dold <florian@dold.me>2024-05-27 21:19:47 +0200
commitbce10929f3b51fa965ff57b61bea0cbb84426da4 (patch)
tree7f910e7f5339525ddc399535cbb0af86039eac16 /packages
parent1623cb3656c6ffb8b4def8e038fc456fdfe21a96 (diff)
downloadwallet-core-bce10929f3b51fa965ff57b61bea0cbb84426da4.tar.xz
wallet-core: test-only request to reset all retries
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-cli/src/index.ts10
-rw-r--r--packages/taler-wallet-core/src/transactions.ts5
-rw-r--r--packages/taler-wallet-core/src/wallet-api-types.ts13
-rw-r--r--packages/taler-wallet-core/src/wallet.ts6
4 files changed, 31 insertions, 3 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index a1b008f5e..5bde7db01 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -1231,6 +1231,16 @@ advancedCli
});
advancedCli
+ .subcommand("resetAllRetries", "reset-all-retries", {
+ help: "Reset all retry counters.",
+ })
+ .action(async (args) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
+ await wallet.client.call(WalletApiOperation.TestingResetAllRetries, {});
+ });
+ });
+
+advancedCli
.subcommand("tasks", "tasks", {
help: "Show active wallet-core tasks.",
})
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(