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.

Where would I set max listeners?

See original GitHub issue

Hey 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:closed
  • Created 3 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tobyjaguarcommented, Jun 4, 2020

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.

1reaction
ricmoocommented, Jun 4, 2020

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. 😃

Read more comments on GitHub >

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

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