Retry on errors 408 and 504 in RetryDecider
Add retry support for 408 and 504 codes per best practices.
API documentation suggests retry logic to handle errors, and indicates the following status codes as ones that should be retried.
- 408 Request Timeout
- 500 Internal Server Error
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Timeout [1]
The library currently includes support for this but only with 500, 502, and 503 errors. This leaves out 408 and 504 which requires a custom handler always be implemented to correctly retry all possible error conditions.
private $httpRetryCodes = [
500,
502,
503
];
...
if (in_array($statusCode, $httpRetryCodes)) {
return true;
}
[2]
Adding 408 and 504 to $httpRetryCodes should enable support for this, due to CLA requirements I am unable to open a PR.
Truncated exponential backoff section for Cloud Storage docs states that client should retry requests for any 5xx code for any Storage request and 408 code for resumable uploads. Looks like we need two custom handlers.
@dwsupplee, what is the status of this feature request? Do we need this feature? If we do, should it be enabled by default or there should be some flag to enable it?