Best practice sending multiple HTTP GET requests
Posted: 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....
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....