-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
4,205 additions
and
4,941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/node_modules/@ledgerhq/live-network/lib-es/network.js b/node_modules/@ledgerhq/live-network/lib-es/network.js | ||
index 41aa14e..f710a9e 100644 | ||
--- a/node_modules/@ledgerhq/live-network/lib-es/network.js | ||
+++ b/node_modules/@ledgerhq/live-network/lib-es/network.js | ||
@@ -4,6 +4,7 @@ import { retry } from "@ledgerhq/live-promise"; | ||
import { log } from "@ledgerhq/logs"; | ||
import axios from "axios"; | ||
import invariant from "invariant"; | ||
+import { HttpsAgent } from 'agentkeepalive'; | ||
export const requestInterceptor = (request) => { | ||
if (!getEnv("ENABLE_NETWORK_LOGS")) { | ||
return request; | ||
@@ -72,8 +73,7 @@ if (!(typeof navigator !== "undefined" && navigator.product === "ReactNative")) | ||
// the keepAlive is necessary when we make a lot of request in in parallel, especially for bitcoin sync. Otherwise, it may raise "connect ETIMEDOUT" error | ||
// refer to https://stackoverflow.com/questions/63064393/getting-axios-error-connect-etimedout-when-making-high-volume-of-calls | ||
// eslint-disable-next-line global-require,@typescript-eslint/no-var-requires | ||
- const https = require("https"); | ||
- axios.defaults.httpsAgent = new https.Agent({ keepAlive: true }); | ||
+ axios.defaults.httpsAgent = new HttpsAgent({ keepAlive: true }); | ||
} | ||
const makeError = (msg, status, url, method) => { | ||
const obj = { | ||
diff --git a/node_modules/@ledgerhq/live-network/src/network.ts b/node_modules/@ledgerhq/live-network/src/network.ts | ||
index de91e00..9fa132f 100644 | ||
--- a/node_modules/@ledgerhq/live-network/src/network.ts | ||
+++ b/node_modules/@ledgerhq/live-network/src/network.ts | ||
@@ -5,6 +5,7 @@ import { log } from "@ledgerhq/logs"; | ||
import type { AxiosError, AxiosRequestConfig, Method } from "axios"; | ||
import axios, { AxiosPromise, AxiosResponse } from "axios"; | ||
import invariant from "invariant"; | ||
+import { HttpsAgent } from 'agentkeepalive'; | ||
|
||
type Metadata = { startTime: number }; | ||
type ExtendedXHRConfig = AxiosRequestConfig & { metadata?: Metadata }; | ||
@@ -104,8 +105,7 @@ if (!(typeof navigator !== "undefined" && navigator.product === "ReactNative")) | ||
// the keepAlive is necessary when we make a lot of request in in parallel, especially for bitcoin sync. Otherwise, it may raise "connect ETIMEDOUT" error | ||
// refer to https://stackoverflow.com/questions/63064393/getting-axios-error-connect-etimedout-when-making-high-volume-of-calls | ||
// eslint-disable-next-line global-require,@typescript-eslint/no-var-requires | ||
- const https = require("https"); | ||
- axios.defaults.httpsAgent = new https.Agent({ keepAlive: true }); | ||
+ axios.defaults.httpsAgent = new HttpsAgent({ keepAlive: true }); | ||
} | ||
|
||
const makeError = (msg: string, status: number, url: string | undefined, method: Method | "") => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.