Where would I set max listeners?
See original GitHub issueHey there,
I tweeted but this may be a better avenue. I see that node has the max listeners set at 10. Where would I update emitter.setMaxListeners(n)
to allow subscribing to more than 10 events on the provider?
provider.on(filter, async result => { });
The above stops responding if there are more than 10 filtered events subscribed on the provider. Just not sure where/how to set the limit higher.
thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
node.js - request - How to "emitter.setMaxListeners()"?
I would rather set max listeners number in your own code: ... setMaxListeners(0); request.get(options, function (error, response, body) { }.
Read more >setMaxListeners JavaScript and Node.js code examples
Best JavaScript code snippets using setMaxListeners(Showing top 15 results out of 315) · src/client/BaseClient.js/BaseClient/incrementMaxListeners · client/src/ ...
Read more >Node.js sends warnings when you add too many listeners to ...
This is the situation, where setMaxListeners comes into play. A function that is also used several times in the Node. js project itself....
Read more >NodeJS EventEmitter: MaxListeners - YouTube
In this video, We used the functions getMaxListeners(), setMaxListeners (num), and the property defaultMaxListeners to manipulated the ...
Read more >Events | Node.js v19.3.0 Documentation
This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter ......
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
I see it, ha ha. And it does indeed. The events fire fine however, unless I add too many. If this is a max request issue with infura, I can shut down the service that is maxing the requests (which is just a staging version of what I am working on). Else I can run it against a local testnet to see if the event listeners are okay there.
I’ll get back if I figure anything out.
That’s my guess as to what is going on. You exceeded your free limit of calls. 😃
You can pay INFURA (or run your own node) to solve this. If you use the v5 default provider, you will get slightly more mileage, since it will spread your calls out over a bunch of different services.
But at the end of the day, if you rely on free services, they are going to cap how many requests you can make. With v5, you can also try the INFURA WebSocket backend, which might let you listen to more filters, since it is less chatty. 😃