gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 01/02: do not add a new request if there is one alre


From: gnunet
Subject: [taler-wallet-core] 01/02: do not add a new request if there is one already
Date: Wed, 17 Jan 2024 20:19:35 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

commit 9875714a026484af1d20fea7aa8762432ce022b9
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Jan 17 16:19:10 2024 -0300

    do not add a new request if there is one already
---
 .../taler-wallet-core/src/operations/withdraw.ts   | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index 6c7e8c37a..29c2cae40 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -1905,6 +1905,11 @@ export interface GetWithdrawalDetailsForUriOpts {
   notifyChangeFromPendingTimeoutMs?: number;
 }
 
+type WithdrawalOperationMemoryMap = {
+  [uri: string]: boolean | undefined;
+}
+const ongoingChecks: WithdrawalOperationMemoryMap = {
+}
 /**
  * Get more information about a taler://withdraw URI.
  *
@@ -1945,7 +1950,10 @@ export async function getWithdrawalDetailsForUri(
     );
   });
 
-  if (info.status === "pending" && opts.notifyChangeFromPendingTimeoutMs !== 
undefined) {
+  // FIXME: this should be removed after the extended version of 
+  // withdrawal state machine. issue #8099
+  if (info.status === "pending" && opts.notifyChangeFromPendingTimeoutMs !== 
undefined && !ongoingChecks[talerWithdrawUri]) {
+    ongoingChecks[talerWithdrawUri] = true;
     const bankApi = new TalerBankIntegrationHttpClient(info.apiBaseUrl, 
ws.http);
     console.log(
       `waiting operation (${info.operationId}) to change from pending`,
@@ -1957,21 +1965,12 @@ export async function getWithdrawalDetailsForUri(
       console.log(
         `operation (${info.operationId}) to change to ${JSON.stringify(resp, 
undefined, 2)}`,
       );
-      if (resp.type === "fail") {
-        //not found, this is rare since the previous request succeed
-        ws.notify({
-          type: NotificationType.WithdrawalOperationTransition,
-          operationId: info.operationId,
-          state: info.status,
-        })
-        return;
-      }
-
       ws.notify({
         type: NotificationType.WithdrawalOperationTransition,
         operationId: info.operationId,
-        state: resp.body.status,
+        state: resp.type === "fail" ? info.status : resp.body.status,
       });
+      ongoingChecks[talerWithdrawUri] = false
     })
   }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]