共用方式為


ExponentialRetry 類別

指數重試。

建構指數重試物件。 第一次重試會使用initial_backoff。 後續重試會在 initial_backoff + increment_power^retry_count 秒之後重試。 例如,根據預設,第一次重試會在 15 秒後發生,第二次在 (15+3^1) = 18 秒,而第三個在 (15+3^2 之後) = 24 秒。

繼承
azure.storage.blob._shared.policies_async.AsyncStorageRetryPolicy
ExponentialRetry

建構函式

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

參數

名稱 Description
initial_backoff
int

第一次重試的初始輪詢間隔,以秒為單位。

預設值: 15
increment_base
int

第一次重試之後,以秒為單位來遞增initial_backoff。

預設值: 3
max_attempts
必要
int

重試嘗試的次數上限。

retry_to_secondary

如果能夠,是否應該將要求重試至次要。 這應該只能啟用 RA-GRS 帳戶,而且可能過時的資料可以處理。

預設值: False
random_jitter_range
int

以秒為單位的數位,表示要對退間隔進行抖動/隨機化的範圍。 例如,3 的random_jitter_range會導致輪詢間隔 x 在 x+3 和 x-3 之間有所不同。

預設值: 3
retry_total
預設值: 3

方法

configure_retries
get_backoff_time

計算重試前的睡眠時間長度。

increment

遞增重試計數器。

send
sleep

configure_retries

configure_retries(request)

參數

名稱 Description
request
必要

get_backoff_time

計算重試前的睡眠時間長度。

get_backoff_time(settings)

參數

名稱 Description
settings
必要

與輪詢時間相關的可設定值。

傳回

類型 Description
int,

整數,指出重試要求之前要等候多久,或 [無] 表示不應該執行重試。

increment

遞增重試計數器。

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

參數

名稱 Description
settings
必要

與遞增作業相關的可設定值。

request
必要
<xref:<xref:"PipelineRequest">>

管線要求物件。

"PipelineResponse"
必要

管線回應物件。

error

要求期間發生錯誤,如果已成功收到回應,則為 None。

預設值: None
response
預設值: None

傳回

類型 Description

重試嘗試是否耗盡。

send

async send(request)

參數

名稱 Description
request
必要

sleep

async sleep(settings, transport)

參數

名稱 Description
settings
必要
transport
必要

屬性

next

下一個原則的指標或包裝為原則) 的傳輸 (指標。 將會在管線建立時設定。

next: HTTPPolicy[HTTPRequestType, HTTPResponseType]