Skip to content

Commit c21de1e

Browse files
Fix Memory Leak in AsyncHttpCall affecting auth.listUsers (#2236)
fixes 2235 The socket code was only introduced to fix a bug in NodeJS 12 (db8be26) and since then has even needed a patch (1a34bc4). However the code does not seem necessary at all anymore. Removing this code resolved the described memory leak. Co-authored-by: Lahiru Maramba <llahiru@gmail.com>
1 parent b9eaae6 commit c21de1e

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

Diff for: src/utils/api-request.ts

-8
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,6 @@ class AsyncHttpCall {
504504
if (timeout) {
505505
// Listen to timeouts and throw an error.
506506
req.setTimeout(timeout, timeoutCallback);
507-
req.on('socket', (socket) => {
508-
socket.setMaxListeners(socket.getMaxListeners() + 1);
509-
socket.setTimeout(timeout, timeoutCallback);
510-
socket.on('end', () => {
511-
socket.setTimeout(0);
512-
socket.setMaxListeners(Math.max(socket.getMaxListeners() - 1, 0));
513-
});
514-
});
515507
}
516508

517509
// Send the request

0 commit comments

Comments
 (0)