Contract events arrive slower #1914
-
I noticed that receiving contract events via |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
What backend are you using? Which event? An Event filter is emitted once it is minded in a block, so it shouldn't matter. But if your backend is something like Ganache, it may be slower than it needs to be, since Ganache mines "instantly" and the polling providers do only poll every 4 seconds (by default). If you are connecting to ganache, you can likely increase the polling rate (by setting the If you are using something like INFURA though, setting this number lower will likely result in your queries getting heavily throttled. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. I am using the MetaMask extension on Chrome desktop and the MetaMask mobile app on Android. For both Ganache locally as well as a deployment on Rinkeby (dev.finfour.net, using INFURA) I noticed that |
Beta Was this translation helpful? Give feedback.
-
Hi @ricmoo, a related question. Let me know if I should open a new issue for this. |
Beta Was this translation helpful? Give feedback.
-
You can use I will probably make v6 only return events starting after the current block, but this is not a change that can be made in v5. |
Beta Was this translation helpful? Give feedback.
You can use
provider.once("block", () => { provider.on(event, handler); })
, which will what for the next block before subscribing.I will probably make v6 only return events starting after the current block, but this is not a change that can be made in v5.