[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: prioritize pendi
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: prioritize pending tasks |
Date: |
Tue, 19 Dec 2023 00:06:29 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new c3dbb3a5d wallet-core: prioritize pending tasks
c3dbb3a5d is described below
commit c3dbb3a5d578a8e1df6d69f892888e2a9460ddbd
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Dec 19 00:06:26 2023 +0100
wallet-core: prioritize pending tasks
---
.../taler-wallet-core/src/operations/exchanges.ts | 6 ++++-
.../taler-wallet-core/src/operations/pending.ts | 26 +++++++++++++++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts
b/packages/taler-wallet-core/src/operations/exchanges.ts
index fe6060499..f4ee80e9e 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -806,7 +806,11 @@ export async function fetchFreshExchange(
const nextUpdate = timestampOptionalAbsoluteFromDb(
oldExchange.nextUpdateStamp,
);
- if (nextUpdate == null || AbsoluteTime.isExpired(nextUpdate)) {
+ if (
+ nextUpdate == null ||
+ AbsoluteTime.isExpired(nextUpdate) ||
+ oldExchange.updateStatus !== ExchangeEntryDbUpdateStatus.Ready
+ ) {
needsUpdate = true;
}
}
diff --git a/packages/taler-wallet-core/src/operations/pending.ts
b/packages/taler-wallet-core/src/operations/pending.ts
index e554a9b0f..76b9fd801 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -735,11 +735,27 @@ async function gatherPeerPushCreditPending(
);
}
+const taskPrio: { [X in PendingTaskType]: number } = {
+ [PendingTaskType.Deposit]: 2,
+ [PendingTaskType.ExchangeUpdate]: 1,
+ [PendingTaskType.PeerPullCredit]: 2,
+ [PendingTaskType.PeerPullDebit]: 2,
+ [PendingTaskType.PeerPushCredit]: 2,
+ [PendingTaskType.Purchase]: 2,
+ [PendingTaskType.Recoup]: 3,
+ [PendingTaskType.RewardPickup]: 2,
+ [PendingTaskType.Refresh]: 3,
+ [PendingTaskType.Withdraw]: 3,
+ [PendingTaskType.ExchangeCheckRefresh]: 3,
+ [PendingTaskType.PeerPushDebit]: 2,
+ [PendingTaskType.Backup]: 4,
+};
+
export async function getPendingOperations(
ws: InternalWalletState,
): Promise<PendingOperationsResponse> {
const now = AbsoluteTime.now();
- return await ws.db
+ const resp = await ws.db
.mktx((x) => [
x.backupProviders,
x.exchanges,
@@ -776,4 +792,12 @@ export async function getPendingOperations(
await gatherPeerPushCreditPending(ws, tx, now, resp);
return resp;
});
+
+ resp.pendingOperations.sort((a, b) => {
+ let prioA = taskPrio[a.type];
+ let prioB = taskPrio[b.type];
+ return Math.sign(prioA - prioB);
+ });
+
+ return resp;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: prioritize pending tasks,
gnunet <=