gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: do normal back-off when reser


From: gnunet
Subject: [taler-wallet-core] branch master updated: do normal back-off when reserve isn't ready yet, run retry-loop in integration test
Date: Thu, 19 Dec 2019 21:22:32 +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 aa37ef08 do normal back-off when reserve isn't ready yet, run 
retry-loop in integration test
aa37ef08 is described below

commit aa37ef082d0e4aaedeb219d0a3f726da146edba7
Author: Florian Dold <address@hidden>
AuthorDate: Thu Dec 19 21:22:29 2019 +0100

    do normal back-off when reserve isn't ready yet, run retry-loop in 
integration test
---
 src/headless/integrationtest.ts |  5 +++++
 src/operations/pending.ts       |  3 ++-
 src/operations/reserves.ts      | 14 +++++++++++---
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts
index 7c513e70..494f7c02 100644
--- a/src/headless/integrationtest.ts
+++ b/src/headless/integrationtest.ts
@@ -40,6 +40,11 @@ export async function runIntegrationTest(args: {
 
   const myWallet = await getDefaultNodeWallet({ httpLib: myHttpLib });
 
+
+  myWallet.runRetryLoop().catch((e) => {
+    console.error("exception during retry loop:", e);
+  });
+
   logger.info("withdrawing test balance");
   await withdrawTestBalance(myWallet, args.amountToWithdraw, args.bankBaseUrl, 
args.exchangeBaseUrl);
   logger.info("done withdrawing test balance");
diff --git a/src/operations/pending.ts b/src/operations/pending.ts
index ed3b59d7..f3cca9f2 100644
--- a/src/operations/pending.ts
+++ b/src/operations/pending.ts
@@ -37,7 +37,8 @@ function updateRetryDelay(
   retryTimestamp: Timestamp,
 ): Duration {
   const remaining = getDurationRemaining(retryTimestamp, now);
-  return durationMin(oldDelay, remaining);
+  const nextDelay =  durationMin(oldDelay, remaining);
+  return nextDelay;
 }
 
 async function gatherExchangePending(
diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 2dedf17d..7f5c7d05 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -53,6 +53,7 @@ import {
 import {
   guardOperationException,
   OperationFailedAndReportedError,
+  OperationFailedError,
 } from "./errors";
 import { NotificationType } from "../types/notifications";
 import { codecForReserveStatus } from "../types/ReserveStatus";
@@ -351,8 +352,11 @@ async function incrementReserveRetry(
     if (!r.retryInfo) {
       return;
     }
+    console.log("updating retry info");
+    console.log("before", r.retryInfo);
     r.retryInfo.retryCounter++;
     updateRetryInfoTimeout(r.retryInfo);
+    console.log("after", r.retryInfo);
     r.lastError = err;
     await tx.put(Stores.reserves, r);
   });
@@ -392,14 +396,18 @@ async function updateReserve(
     resp = await ws.http.get(reqUrl.href);
     console.log("got reserve/status response", await resp.json());
     if (resp.status === 404) {
-      const m = "The exchange does not know about this reserve (yet).";
-      await incrementReserveRetry(ws, reservePub, undefined);
-      return;
+      const m = "reserve not known to the exchange yet"
+      throw new OperationFailedError(m, {
+        type: "waiting",
+        message: m,
+        details: {},
+      });
     }
     if (resp.status !== 200) {
       throw Error(`unexpected status code ${resp.status} for reserve/status`);
     }
   } catch (e) {
+    logger.trace("caught exception for reserve/status");
     const m = e.message;
     await incrementReserveRetry(ws, reservePub, {
       type: "network",

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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