Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MaxListenersExceededWarning from WebSocketTracker #288

Open
Nuru opened this issue Sep 4, 2018 · 1 comment
Open

MaxListenersExceededWarning from WebSocketTracker #288

Nuru opened this issue Sep 4, 2018 · 1 comment

Comments

@Nuru
Copy link

Nuru commented Sep 4, 2018

When I seed a lot of torrents from Node.js via webtorrent-hybrid, I get MaxListenersExceededWarning from WebSocketTracker._openSocket . I think this is because multiple torrents are listening on the same pooled WebSocket, and thus this is not a genuine bug or memory leak. If I'm right about that, then I would like to have a sane way to set the warning limit to be something proportional to the number of torrents I am seeding.

I know this warning can be suppressed by setting EventEmitter.defaultMaxListeners to a bigger number, but that has global effect and I do not want to suppress the warning globally. I would be willing to call emitter.setMaxListeners() myself if there is not a reasonable way for bittorrent-tracker to figure out the right value, but I need an API for that which lets me get to the WebSocketTracker from the webtorrent-hybrid client object.

@feross
Copy link
Member

feross commented Sep 10, 2019

We can fix this by calling emitter.setMaxListeners() to Infinity internally. PR welcome!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants