question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should remove listener to timeout event

See original GitHub issue

At 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dougwilsoncommented, Jun 1, 2018

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 👍

0reactions
dougwilsoncommented, Nov 7, 2018

So I’m going to close this since it seems to have stalled and never got the needed information here to proceed.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found