gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: fix excessive retries


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix excessive retries
Date: Fri, 24 Jul 2020 11:22:20 +0200

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 880f335e fix excessive retries
880f335e is described below

commit 880f335ee648743f6e58918b5a62b42c4f0962bb
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Fri Jul 24 14:52:14 2020 +0530

    fix excessive retries
---
 src/operations/reserves.ts | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 6045b61d..fdc35bb1 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -465,14 +465,14 @@ async function incrementReserveRetry(
 async function updateReserve(
   ws: InternalWalletState,
   reservePub: string,
-): Promise<void> {
+): Promise<{ ready: boolean }> {
   const reserve = await ws.db.get(Stores.reserves, reservePub);
   if (!reserve) {
     throw Error("reserve not in db");
   }
 
   if (reserve.reserveStatus !== ReserveRecordStatus.QUERYING_STATUS) {
-    return;
+    return { ready: true };
   }
 
   const resp = await ws.http.get(
@@ -493,7 +493,7 @@ async function updateReserve(
         reservePub,
       });
       await incrementReserveRetry(ws, reservePub, undefined);
-      return;
+      return { ready: false };
     } else {
       throwUnexpectedRequestError(resp, result.talerErrorResponse);
     }
@@ -562,6 +562,7 @@ async function updateReserve(
     },
   );
   ws.notify({ type: NotificationType.ReserveUpdated });
+  return { ready: true };
 }
 
 async function processReserveImpl(
@@ -590,9 +591,14 @@ async function processReserveImpl(
     case ReserveRecordStatus.REGISTERING_BANK:
       await processReserveBankStatus(ws, reservePub);
       return await processReserveImpl(ws, reservePub, true);
-    case ReserveRecordStatus.QUERYING_STATUS:
-      await updateReserve(ws, reservePub);
-      return await processReserveImpl(ws, reservePub, true);
+    case ReserveRecordStatus.QUERYING_STATUS: {
+      const res = await updateReserve(ws, reservePub);
+      if (res.ready) {
+        return await processReserveImpl(ws, reservePub, true);
+      } else {
+        break;
+      }
+    }
     case ReserveRecordStatus.WITHDRAWING:
       await depleteReserve(ws, reservePub);
       break;

-- 
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]