Application stops receiving events after N* event

Hi everyone.
Who can help me to find the answer? I use web3js to listen contract events. In my contract I use Provable API to loop contract logic, and then I receive contact event each 5 minutes because of provable loop. But I noticed that despite everything work in contract (I see a lot of transactions and events at etherescan), I receive just several ~10-20 events in my app and then it stops receiving events. Who can help me to find the reason of that?
I use kovan testnet, infura free plan as web3 provider and my application is located on localhost.
Does it have any limitation?

Hi @denis.ponizhan, how many calls are you making when it loops every 5 minutes? Only 10-20?

This looks like you are running into rate limiting restrictions, on the free tier you can make about 1 request a second on average.

Hi @Sean_Infura! Many thanks for quick answer.
If I understand your question right, I don’t do any calls. I only subscribed at contract event like this:'data', event => {
     // internal logic

and new event occurs every 5 minutes.
Also I noticed that if I reload JavaScript file it starts receiving events again, but still for a several times.

Ok, can you console log the errors as well to see which you are getting? the code to do that is described here

Ok, I will start my app with logging errors to console and then reply to you again.

Hi @Sean_Infura!
I have done testing with logging errors to console like this:
      .on('data', event => {
          // ...
      .on('error', console.error);

But there weren’t any errors.
I was testing my app for 5 hours yesterday, and from 60 events my application received only ~30 first.

Hey @denis.ponizhan, okay not receiving errors is a good sign. A couple more questions because I’m unfamiliar with the Provable API.

Can you try setting the Provable loop to get events every 4 minutes instead of 5? You might be hitting a 5 minute timeout.
Are you using your own personal Infura API key in your app, as a web3.js Provider?
Is Provable API the one calling the Infura HTTP URL as a data source? If so, what is this doing and why not call Infura directly?

I’ve started a virtual office hours to help if you’d like to join a zoom call on Thursdays at 10 am Pacific time.