Guzzle - PHP - Several minutes timeout even when connect_timeout and timeout parameters are set

Viewed 213

I use the following Guzzle constructor with connect_timeout and timeout set to 6.0 seconds:

  $this->client = new GuzzleClient([                                                                                                                     
      'connect_timeout' => 6.0,                                                                
      'timeout' => 6.0,                                                                                          
      ... some other options ...                                                                 
  ]);              
                                                                            

However, from time to time, I get the following exception when making HTTP requests:

GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 129810 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

The timeout is clearly higher than the timeout values I have set for the Guzzle client.

As far as I understand, the options connect_timeout and timeout should prevent such a high timeout value, is there an option I'm missing or a way to be sure the timeout will be at max 6 seconds ?

0 Answers
Related