googleapis / googleapis/google-cloud-php

Retry on errors 408 and 504 in RetryDecider

Open
#2,633 1 comment 0 reactions 0 assignees View on GitHub
type: feature request
Dominant language
PHP
Stars
1.2k
Forks
463
Avg merge
2d 1h
Merged PRs (30d)
145

Description

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](https://cloud.google.com/storage/docs/resumable-uploads#practices)]

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](https://github.com/googleapis/google-cloud-php/blob/master/Core/src/RetryDeciderTrait.php#L32)]

Adding 408 and 504 to $httpRetryCodes should enable support for this, due to CLA requirements I am unable to open a PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.