Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class ExponentialBackoff.
Exponential backoff implementation.
Namespace
Google \ Cloud \ Core
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
retryListener
callable
[optional] Runs after the
$retryFunction. Unlike the $retryFunction,this function isn't
responsible to decide if a retry should happen or not, but it gives the
users flexibility to consume exception messages and add custom logic.
Function definition should match:
function (\Exception $e, int $attempt, array $arguments): array
Ex: One might want to change headers on every retry, this function can
be used to achieve such a functionality.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud PHP shared dependency, providing functionality useful to all components. Client - Class ExponentialBackoff (1.64.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.64.2 (latest)](/php/docs/reference/cloud-core/latest/ExponentialBackoff)\n- [1.64.1](/php/docs/reference/cloud-core/1.64.1/ExponentialBackoff)\n- [1.63.0](/php/docs/reference/cloud-core/1.63.0/ExponentialBackoff)\n- [1.62.3](/php/docs/reference/cloud-core/1.62.3/ExponentialBackoff)\n- [1.61.0](/php/docs/reference/cloud-core/1.61.0/ExponentialBackoff)\n- [1.60.1](/php/docs/reference/cloud-core/1.60.1/ExponentialBackoff)\n- [1.59.1](/php/docs/reference/cloud-core/1.59.1/ExponentialBackoff)\n- [1.58.2](/php/docs/reference/cloud-core/1.58.2/ExponentialBackoff)\n- [1.53.0](/php/docs/reference/cloud-core/1.53.0/ExponentialBackoff)\n- [1.52.11](/php/docs/reference/cloud-core/1.52.11/ExponentialBackoff)\n- [1.51.2](/php/docs/reference/cloud-core/1.51.2/ExponentialBackoff)\n- [1.50.0](/php/docs/reference/cloud-core/1.50.0/ExponentialBackoff)\n- [1.49.3](/php/docs/reference/cloud-core/1.49.3/ExponentialBackoff)\n- [1.48.1](/php/docs/reference/cloud-core/1.48.1/ExponentialBackoff) \nReference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class ExponentialBackoff.\n\nExponential backoff implementation.\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Core\n\nMethods\n-------\n\n### __construct\n\n### execute\n\nExecutes the retry process.\n\n### setDelayFunction\n\nIf not set, defaults to using `usleep`.\n\n### setCalcDelayFunction\n\nIf not set, defaults to using\n[ExponentialBackoff::calculateDelay()](/php/docs/reference/cloud-core/latest/ExponentialBackoff#_Google_Cloud_Core_ExponentialBackoff__calculateDelay__).\n\n### static::calculateDelay\n\nCalculates exponential delay.\n\nConstants\n---------\n\n### MAX_DELAY_MICROSECONDS\n\n Value: 60000000"]]