gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: use default http timeout from


From: gnunet
Subject: [taler-wallet-core] branch master updated: use default http timeout from util
Date: Wed, 28 Jun 2023 14:49:58 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new f1008c966 use default http timeout from util
f1008c966 is described below

commit f1008c966191f5b1d3bf1f7ea8af4fbba4380b46
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Jun 28 09:49:29 2023 -0300

    use default http timeout from util
---
 packages/taler-util/src/time.ts                  | 6 ++++++
 packages/web-util/src/utils/http-impl.browser.ts | 5 ++++-
 packages/web-util/src/utils/http-impl.sw.ts      | 5 ++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts
index 3ecf6f92c..75b3c7e94 100644
--- a/packages/taler-util/src/time.ts
+++ b/packages/taler-util/src/time.ts
@@ -296,6 +296,12 @@ export namespace Duration {
     };
   }
 
+  export function fromMilliseconds(ms: number): Duration {
+    return {
+      d_ms: ms,
+    };
+  }
+
   export function clamp(args: {
     lower: Duration;
     upper: Duration;
diff --git a/packages/web-util/src/utils/http-impl.browser.ts 
b/packages/web-util/src/utils/http-impl.browser.ts
index a46e8d63f..598146149 100644
--- a/packages/web-util/src/utils/http-impl.browser.ts
+++ b/packages/web-util/src/utils/http-impl.browser.ts
@@ -22,6 +22,7 @@ import {
   RequestThrottler,
   TalerErrorCode,
   TalerError,
+  Duration,
 } from "@gnu-taler/taler-util";
 
 import {
@@ -31,6 +32,7 @@ import {
   Headers,
   getDefaultHeaders,
   encodeBody,
+  DEFAULT_REQUEST_TIMEOUT_MS,
 } from "@gnu-taler/taler-util/http";
 
 const logger = new Logger("browserHttpLib");
@@ -50,7 +52,8 @@ export class BrowserHttpLib implements HttpRequestLibrary {
     const requestMethod = options?.method ?? "GET";
     const requestBody = options?.body;
     const requestHeader = options?.headers;
-    const requestTimeout = options?.timeout ?? { d_ms: 2 * 1000 };
+    const requestTimeout =
+      options?.timeout ?? 
Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);
 
     if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {
       const parsedUrl = new URL(requestUrl);
diff --git a/packages/web-util/src/utils/http-impl.sw.ts 
b/packages/web-util/src/utils/http-impl.sw.ts
index 59bef1775..dbb1f7834 100644
--- a/packages/web-util/src/utils/http-impl.sw.ts
+++ b/packages/web-util/src/utils/http-impl.sw.ts
@@ -21,9 +21,11 @@ import {
   RequestThrottler,
   TalerErrorCode,
   TalerError,
+  Duration,
 } from "@gnu-taler/taler-util";
 
 import {
+  DEFAULT_REQUEST_TIMEOUT_MS,
   Headers,
   HttpRequestLibrary,
   HttpRequestOptions,
@@ -47,7 +49,8 @@ export class ServiceWorkerHttpLib implements 
HttpRequestLibrary {
     const requestMethod = options?.method ?? "GET";
     const requestBody = options?.body;
     const requestHeader = options?.headers;
-    const requestTimeout = options?.timeout ?? { d_ms: 2 * 1000 };
+    const requestTimeout =
+      options?.timeout ?? 
Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);
 
     if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {
       const parsedUrl = new URL(requestUrl);

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