Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class ExponentialBackoff.
Exponential backoff implementation.
Methods
__construct
| Parameters | |
|---|---|
| Name | Description |
retries |
int
[optional] Number of retries for a failed request. |
retryFunction |
callable
[optional] returns bool for whether or not to retry |
execute
Executes the retry process.
| Parameters | |
|---|---|
| Name | Description |
function |
callable
|
arguments |
array
[optional] |
| Returns | |
|---|---|
| Type | Description |
mixed |
|
setDelayFunction
If not set, defaults to using usleep.
| Parameter | |
|---|---|
| Name | Description |
delayFunction |
callable
|
| Returns | |
|---|---|
| Type | Description |
void |
|
setCalcDelayFunction
If not set, defaults to using Google\Cloud\Core\ExponentialBackoff::calculateDelay().
| Parameter | |
|---|---|
| Name | Description |
calcDelayFunction |
callable
|
| Returns | |
|---|---|
| Type | Description |
void |
|
calculateDelay
Calculates exponential delay.
| Parameter | |
|---|---|
| Name | Description |
attempt |
int
The attempt number used to calculate the delay. |
| Returns | |
|---|---|
| Type | Description |
int |
|
Constants
MAX_DELAY_MICROSECONDS
Value: 60000000