gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: clamp claim retr


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: clamp claim retry properly
Date: Thu, 19 May 2022 10:55:30 +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 b2931fba wallet-core: clamp claim retry properly
b2931fba is described below

commit b2931fbac62a128862f310028c16b32b12f0c14e
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu May 19 10:36:01 2022 +0200

    wallet-core: clamp claim retry properly
---
 packages/taler-util/src/time.ts                  | 14 ++++++++++++++
 packages/taler-wallet-cli/src/harness/harness.ts |  2 +-
 packages/taler-wallet-core/src/operations/pay.ts | 10 +++++-----
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts
index f12e8d32..8b0516bf 100644
--- a/packages/taler-util/src/time.ts
+++ b/packages/taler-util/src/time.ts
@@ -91,19 +91,24 @@ export namespace Duration {
     }
     return { d_ms: deadline.t_ms - now.t_ms };
   }
+
   export function toIntegerYears(d: Duration): number {
     if (typeof d.d_ms !== "number") {
       throw Error("infinite duration");
     }
     return Math.ceil(d.d_ms / 1000 / 60 / 60 / 24 / 365);
   }
+
   export const fromSpec = durationFromSpec;
+
   export function getForever(): Duration {
     return { d_ms: "forever" };
   }
+
   export function getZero(): Duration {
     return { d_ms: 0 };
   }
+
   export function fromTalerProtocolDuration(
     d: TalerProtocolDuration,
   ): Duration {
@@ -116,6 +121,7 @@ export namespace Duration {
       d_ms: d.d_us / 1000,
     };
   }
+
   export function toTalerProtocolDuration(d: Duration): TalerProtocolDuration {
     if (d.d_ms === "forever") {
       return {
@@ -126,6 +132,14 @@ export namespace Duration {
       d_us: d.d_ms * 1000,
     };
   }
+
+  export function clamp(args: {
+    lower: Duration;
+    upper: Duration;
+    value: Duration;
+  }): Duration {
+    return durationMax(durationMin(args.value, args.upper), args.lower);
+  }
 }
 
 export namespace AbsoluteTime {
diff --git a/packages/taler-wallet-cli/src/harness/harness.ts 
b/packages/taler-wallet-cli/src/harness/harness.ts
index a2339e5f..b0b4a137 100644
--- a/packages/taler-wallet-cli/src/harness/harness.ts
+++ b/packages/taler-wallet-cli/src/harness/harness.ts
@@ -1659,7 +1659,7 @@ export class MerchantService implements 
MerchantServiceInterface {
     await exec(`taler-merchant-dbinit -c "${this.configFilename}"`);
 
     this.proc = this.globalState.spawnService(
-      "valgrind",
+      "taler-merchant-httpd",
       [
         "taler-merchant-httpd",
         "-LDEBUG",
diff --git a/packages/taler-wallet-core/src/operations/pay.ts 
b/packages/taler-wallet-core/src/operations/pay.ts
index b28faa4c..e8604d3f 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -26,7 +26,6 @@
  */
 import {
   AbsoluteTime,
-  AgeRestriction,
   AmountJson,
   Amounts,
   codecForContractTerms,
@@ -606,10 +605,11 @@ async function failProposalPermanently(
 }
 
 function getProposalRequestTimeout(proposal: ProposalRecord): Duration {
-  return durationMax(
-    { d_ms: 60000 },
-    durationMin({ d_ms: 5000 }, RetryInfo.getDuration(proposal.retryInfo)),
-  );
+  return Duration.clamp({
+    lower: Duration.fromSpec({ seconds: 1}),
+    upper: Duration.fromSpec({seconds: 60}),
+    value: getRetryDuration(proposal.retryInfo),
+  });
 }
 
 function getPayRequestTimeout(purchase: PurchaseRecord): Duration {

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