Best practice sending multiple HTTP GET requests

alve89
Posts: 4
Joined: Thu Apr 23, 2020 2:36 pm

Best practice sending multiple HTTP GET requests

Postby alve89 » Thu Jul 23, 2020 6:39 am

Hey guys,

after a little research why some of my requests end in an error I thought there might be a "best practice" to send multiple GET-requests in a short while (with library HTTPClient).

My basics: After I had a little problem with Cloudflare blocking my Vodafone home static IP address I added a delay for sending the requests. I collect up to 30 requests in an array and after a random delay for each request (between 1 and 10 seconds) I send every single request.
Some requests instantly work properly (code 200), some end in an error (-11). The requests themself are okay because after the 2nd / 3rd try the same "faulty" requests get also a 200.
Now I saw that -11 means HTTPC_ERROR_READ_TIMEOUT. Those requests take longer as I can see via Serial.print().

Could I solve this -11 problematic by using http.setReuse(true)? Does someone have a better idea how to improve that and prevent failing of sending some requests?

Intention (besides my "perfectionism" [as perfect I can act as a absolute beginner): At the same time a water pump could run which is controlled by time - if the requests take longer than expected the pump also runs longer which could cause some flooding in my living room....

Who is online

Users browsing this forum: No registered users and 67 guests