ExponentialRetry Class

Exponential retry.

Constructs an Exponential retry object. The initial_backoff is used for the first retry. Subsequent retries are retried after initial_backoff + increment_power^retry_count seconds.

Inheritance
azure.storage.blob._shared.policies.StorageRetryPolicy
ExponentialRetry

Constructor

ExponentialRetry(initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs)

Parameters

Name Description
initial_backoff
int

The initial backoff interval, in seconds, for the first retry.

default value: 15
increment_base
int

The base, in seconds, to increment the initial_backoff by after the first retry.

default value: 3
max_attempts
Required
int

The maximum number of retry attempts.

retry_to_secondary

Whether the request should be retried to secondary, if able. This should only be enabled of RA-GRS accounts are used and potentially stale data can be handled.

default value: False
random_jitter_range
int

A number in seconds which indicates a range to jitter/randomize for the back-off interval. For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3.

default value: 3
retry_total
default value: 3

Methods

configure_retries
get_backoff_time

Calculates how long to sleep before retrying.

increment

Increment the retry counters.

send
sleep

configure_retries

configure_retries(request)

Parameters

Name Description
request
Required

get_backoff_time

Calculates how long to sleep before retrying.

get_backoff_time(settings)

Parameters

Name Description
settings
Required

The configurable values pertaining to get backoff time.

Returns

Type Description
int,

An integer indicating how long to wait before retrying the request, or None to indicate no retry should be performed.

increment

Increment the retry counters.

increment(settings, request, response=None, error=None)

Parameters

Name Description
settings
Required

The configurable values pertaining to the increment operation.

request
Required
<xref:<xref:"PipelineRequest">>

A pipeline request object.

"PipelineResponse"
Required

A pipeline response object.

error

An error encountered during the request, or None if the response was received successfully.

default value: None
response
default value: None

Returns

Type Description

Whether the retry attempts are exhausted.

send

send(request)

Parameters

Name Description
request
Required

sleep

sleep(settings, transport)

Parameters

Name Description
settings
Required
transport
Required

Attributes

next

Pointer to the next policy or a transport (wrapped as a policy). Will be set at pipeline creation.

next: HTTPPolicy[HTTPRequestType, HTTPResponseType]