How to set it retry after curl timeout ?
maojindao55 opened this issue · comments
How to set it retry after curl timeout ?
Hi @maojindao55, I just added this feature to the latest release.
So, make sure you update your composer file to require "caseyamcl/guzzle_retry_middleware": "^2.0"
.
Then, you can set it to retry after a timeout like this:
$response = $client->get('http://some-url.com', [
'retry_on_timeout' => true // Retry when connection times out
]);
You can use it in combination with the connect_timeout
and timeout
built-in options like this:
$response = $client->get('http://some-url.com', [
'connect_timeout' => 10 //Connection timeout after 20 seconds
'retry_on_timeout' => true // Retry when connection times out
]);
You can also set all requests to retry on timeout for a client by defining the settings when you build the client.
@caseyamcl thx, i will have a try!