Should remove listener to timeout event
See original GitHub issueAt this moment with default settings there is a subscription added
req.on('timeout', onTimeout(delay, next))
It would be a good idea to unsubscribe from it to avoid mem leak in a long run.
Could be something like:
const onTimeoutCb = delay => {
req.removeListener('timeout', onTimeoutCb);
onTimeout(delay, next)();
};
req.on('timeout', onTimeout);
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Can settimeout collide with cleartimeout from eventListener ...
I remove the event listener because the code from the timeout could have already started and still to proceed attaching the event before...
Read more >Optimizing JavaScript Event Listeners for Performance
It will cause the event listener to ignore some portion of the events while still firing the listeners at a constant (but reduced)...
Read more >Setting and clearing setTimeout() inside of an event handler
I have an event handler function which every time is triggered should clear a setTimeout() and set a new timeout.
Read more >Window clearTimeout() Method - W3Schools
To clear a timeout, use the id returned from setTimeout():. myTimeout = setTimeout(function, milliseconds);. Then you can to stop the execution by calling ......
Read more >Handling Events :: Eloquent JavaScript
We also clear the previous timeout (if any) so that when events occur close together (closer than our timeout delay), the timeout from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It doesn’t matter how big or small it is: that is why I will take a memory dump, because you’ll be able to see a leak of any size easily since the number of remaining objects will be the same regardless of their size 👍
So I’m going to close this since it seems to have stalled and never got the needed information here to proceed.