summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-02-29 23:50:30 +0100
committerFlorian Dold <florian@dold.me>2024-02-29 23:50:30 +0100
commit5af31804c98c53691fd03dc0083f10d694cfeb75 (patch)
tree4ff6f71dc9046f0f73e126eae7080c78f196c002 /packages/taler-wallet-core/src/wallet.ts
parent7480e7870ce486b670f3e2ff6b3363563cec9fa5 (diff)
downloadwallet-core-5af31804c98c53691fd03dc0083f10d694cfeb75.tar.gz
wallet-core-5af31804c98c53691fd03dc0083f10d694cfeb75.tar.bz2
wallet-core-5af31804c98c53691fd03dc0083f10d694cfeb75.zip
fix condition
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r--packages/taler-wallet-core/src/wallet.ts68
1 files changed, 38 insertions, 30 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index b397c43d5..879508036 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -172,7 +172,6 @@ import {
CoinSourceType,
ConfigRecordKey,
DenominationRecord,
- OperationRetryRecord,
WalletDbReadOnlyTransaction,
WalletStoresV1,
clearDatabase,
@@ -181,7 +180,6 @@ import {
openStoredBackupsDatabase,
openTalerDatabase,
timestampAbsoluteFromDb,
- timestampPreciseFromDb,
timestampProtocolToDb,
} from "./db.js";
import {
@@ -519,9 +517,9 @@ async function dumpCoins(wex: WalletExecutionContext): Promise<CoinDumpJson> {
ageCommitmentProof: c.ageCommitmentProof,
spend_allocation: c.spendAllocation
? {
- amount: c.spendAllocation.amount,
- id: c.spendAllocation.id,
- }
+ amount: c.spendAllocation.amount,
+ id: c.spendAllocation.id,
+ }
: undefined,
});
}
@@ -989,31 +987,41 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
return {};
}
case WalletApiOperation.GetActiveTasks: {
- const allTasksId = wex.taskScheduler.getActiveTasks()
+ const allTasksId = wex.taskScheduler.getActiveTasks();
+
+ const tasksInfo = await Promise.all(
+ allTasksId.map(async (id) => {
+ return await wex.ws.db.runReadOnlyTx(
+ ["operationRetries"],
+ async (tx) => {
+ return tx.operationRetries.get(id);
+ },
+ );
+ }),
+ );
- const tasksInfo = await Promise.all(allTasksId.map(async (id) => {
- return await wex.ws.db.runReadOnlyTx(
- ["operationRetries"],
- async (tx) => {
- return tx.operationRetries.get(id);
- },
- )
- }))
-
- const tasks = allTasksId
- .map((taskId, i): ActiveTask => {
- const transaction = convertTaskToTransactionId(taskId);
- const d = tasksInfo[i]
-
- const firstTry = !d?undefined:timestampAbsoluteFromDb(d.retryInfo.firstTry)
- const nextTry = !d?undefined:timestampAbsoluteFromDb(d.retryInfo.nextRetry)
- const counter = d?.retryInfo.retryCounter
- const lastError = d?.lastError
-
- return {
- id: taskId, counter, firstTry, nextTry, lastError, transaction
- }
- })
+ const tasks = allTasksId.map((taskId, i): ActiveTask => {
+ const transaction = convertTaskToTransactionId(taskId);
+ const d = tasksInfo[i];
+
+ const firstTry = !d
+ ? undefined
+ : timestampAbsoluteFromDb(d.retryInfo.firstTry);
+ const nextTry = !d
+ ? undefined
+ : timestampAbsoluteFromDb(d.retryInfo.nextRetry);
+ const counter = d?.retryInfo.retryCounter;
+ const lastError = d?.lastError;
+
+ return {
+ id: taskId,
+ counter,
+ firstTry,
+ nextTry,
+ lastError,
+ transaction,
+ };
+ });
return { tasks };
}
case WalletApiOperation.FailTransaction: {
@@ -1491,7 +1499,7 @@ async function handleCoreApiRequest(
wex = getObservedWalletExecutionContext(ws, CancellationToken.CONTINUE, oc);
} else {
oc = {
- observe(evt) { },
+ observe(evt) {},
};
wex = getNormalWalletExecutionContext(ws, CancellationToken.CONTINUE, oc);
}