Skip to content

Commit

Permalink
Update keepAlive todo
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Mar 29, 2022
1 parent 1112ba5 commit 22b0dba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/node/src/transports/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ export function makeNodeTransport(options: NodeTransportOptions): NewTransport {

const nativeHttpModule = isHttps ? https : http;

// TODO(v7): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node
// versions(>= 8) as they had memory leaks when using it: #2555
const agent = proxy
? (new (require('https-proxy-agent'))(proxy) as http.Agent)
: // TODO(v7): Set keepAlive to true. Older versions of node had memory leaks when using it: #2555
new nativeHttpModule.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });
: new nativeHttpModule.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });

const requestExecutor = createRequestExecutor(options, options.httpModule ?? nativeHttpModule, agent);
return createTransport({ bufferSize: options.bufferSize }, requestExecutor);
Expand Down

0 comments on commit 22b0dba

Please sign in to comment.