Skip to content

Commit bfe174c

Browse files
committed
remove http agents
1 parent 9b53c12 commit bfe174c

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

bin/testObservability/crashReporter/index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ const logger = require("../../helpers/logger").winstonLogger;
99
const { API_URL, consoleHolder } = require('../helper/constants');
1010

1111
/* Below global methods are added here to remove cyclic dependency with helper.js, refactor later */
12-
const httpKeepAliveAgent = new http.Agent({
13-
keepAlive: true,
14-
timeout: 60000,
15-
maxSockets: 2,
16-
maxTotalSockets: 2
17-
});
18-
1912
const httpsKeepAliveAgent = new https.Agent({
2013
keepAlive: true,
2114
timeout: 60000,
@@ -125,7 +118,7 @@ class CrashReporter {
125118
url: `${API_URL}/api/v1/analytics`,
126119
body: data,
127120
json: true,
128-
agent: API_URL.includes('https') ? httpsKeepAliveAgent : httpKeepAliveAgent
121+
agent: httpsKeepAliveAgent
129122
};
130123

131124
request(options, function callback(error, response, body) {

bin/testObservability/helper/helper.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,13 @@ exports.debug = (text, shouldReport = false, throwable = null) => {
4040

4141
const supportFileContentMap = {};
4242

43-
exports.httpKeepAliveAgent = new http.Agent({
44-
keepAlive: true,
45-
timeout: 60000,
46-
maxSockets: 2,
47-
maxTotalSockets: 2
48-
});
49-
5043
exports.httpsKeepAliveAgent = new https.Agent({
5144
keepAlive: true,
5245
timeout: 60000,
5346
maxSockets: 2,
5447
maxTotalSockets: 2
5548
});
5649

57-
const httpScreenshotsKeepAliveAgent = new http.Agent({
58-
keepAlive: true,
59-
timeout: 60000,
60-
maxSockets: 2,
61-
maxTotalSockets: 2
62-
});
63-
6450
const httpsScreenshotsKeepAliveAgent = new https.Agent({
6551
keepAlive: true,
6652
timeout: 60000,
@@ -108,11 +94,11 @@ const nodeRequest = (type, url, data, config) => {
10894
url: `${API_URL}/${url}`,
10995
body: data,
11096
json: config.headers['Content-Type'] === 'application/json',
111-
agent: API_URL.includes('https') ? this.httpsKeepAliveAgent : this.httpKeepAliveAgent
97+
agent: this.httpsKeepAliveAgent
11298
}};
11399

114100
if(url === exports.requestQueueHandler.screenshotEventUrl) {
115-
options.agent = API_URL.includes('https') ? httpsScreenshotsKeepAliveAgent : httpScreenshotsKeepAliveAgent;
101+
options.agent = httpsScreenshotsKeepAliveAgent;
116102
}
117103

118104
request(options, function callback(error, response, body) {

0 commit comments

Comments
 (0)