d8-contrib-modules / cloudflarephpsdk

PHP SDK For interfacing with CloudFlare's API
8 stars 19 forks source link

Purging works sporadically due to API client timeout #29

Open fiasco opened 6 years ago

fiasco commented 6 years ago

I'm getting errors from the Cloudflare purger at times due to the client set timeout. I've verified API limits have not been breached but instead this is simply because Cloudflare had not responded in a timely manor.

Reported Error:

purger_cloudflare_055f11ff77: cURL error 28: Operation timed out after 3000 milliseconds with 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Whats unclear to me, is why, even after three seconds waiting for a response, no purging takes place. My default thought would be to extend the timeout to see if cloudflare timeouts to the API reduce.

doz007 commented 3 years ago

I had the same problem with purging tags on my Drupal site. After such a timeout, the invalidations stay in the purge queue. When new tag invalidations are added, they are joined into the next purge request, which makes the purge request even slower.
I tried to repeat such a purge request of 30 tags using Postman and it took 11 seconds to complete. The same request with 6 tags took 2.6 seconds.
So increasing to 6 seconds will be better, but it might not be enough when the number of tags add up, at least for my site.