你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

LinearRetry Class

Linear retry.

Constructs a Linear retry object.

Constructor

Python
LinearRetry(backoff: int = 15, retry_total: int = 3, retry_to_secondary: bool = False, random_jitter_range: int = 3, **kwargs: Any)

Parameters

Name Description
backoff
int

The backoff interval, in seconds, between retries.

Default value: 15
retry_total
int

The maximum number of retry attempts.

Default value: 3
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

Methods

configure_retries
get_backoff_time

Calculates how long to sleep before retrying.

increment

Increment the retry counters.

send
sleep

configure_retries

Python
configure_retries(request: PipelineRequest) -> Dict[str, Any]

Parameters

Name Description
request
Required

get_backoff_time

Calculates how long to sleep before retrying.

Python
get_backoff_time(settings: Dict[str, Any]) -> float

Parameters

Name Description
settings
Required
Dict[str, Any]]

The configurable values pertaining to the backoff time.

Returns

Type Description

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

increment

Increment the retry counters.

Python
increment(settings: Dict[str, Any], request: PipelineRequest, response: PipelineResponse | None = None, error: AzureError | None = None) -> bool

Parameters

Name Description
settings
Required

The configurable values pertaining to the increment operation.

request
Required
<xref:PipelineRequest>

A pipeline request object.

response
Required
Optional[<xref:PipelineResponse>]

A pipeline response object.

Default value: None
error
Required
Optional[<xref:AzureError>]

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

Default value: None

Returns

Type Description

Whether the retry attempts are exhausted.

send

Python
send(request)

Parameters

Name Description
request
Required

sleep

Python
sleep(settings, transport)

Parameters

Name Description
settings
Required
transport
Required

Attributes

connect_retries

The max number of connect retries.

Python
connect_retries: int

initial_backoff

The backoff interval, in seconds, between retries.

Python
initial_backoff: int

next

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

Python
next: HTTPPolicy[HTTPRequestType, HTTPResponseType]

random_jitter_range

A number in seconds which indicates a range to jitter/randomize for the back-off interval.

Python
random_jitter_range: int

retry_read

The max number of read retries.

Python
retry_read: int

retry_status

The max number of status retries.

Python
retry_status: int

retry_to_secondary

Whether the secondary endpoint should be retried.

Python
retry_to_secondary: bool

total_retries

The max number of retries.

Python
total_retries: int