BlobRequestOptions.RetryPolicy Property

Definition

Gets or sets the retry policy for the request.

public Microsoft.Azure.Storage.RetryPolicies.IRetryPolicy RetryPolicy { get; set; }
member this.RetryPolicy : Microsoft.Azure.Storage.RetryPolicies.IRetryPolicy with get, set
Public Property RetryPolicy As IRetryPolicy

Property Value

An object of type IRetryPolicy.

Implements

Examples


// Create a Linear Retry Policy.
// This retry policy will instruct the Storage Client to retry the request in a linear fashion.
// This particular retry policy will retry the request every 20 seconds, up to a maximum of 4 retries.
BlobRequestOptions optionsWithRetryPolicy = new BlobRequestOptions() { RetryPolicy = new RetryPolicies.LinearRetry(TimeSpan.FromSeconds(20), 4) };

int byteCount = blob.DownloadToByteArray(destinationArray, index: 0, accessCondition: null, options: optionsWithRetryPolicy);

// This retry policy will never retry.
optionsWithRetryPolicy = new BlobRequestOptions() { RetryPolicy = new RetryPolicies.NoRetry() };
byteCount = blob.DownloadToByteArray(destinationArray, index: 0, accessCondition: null, options: optionsWithRetryPolicy);

Remarks

Retry policies instruct the Storage Client to retry failed requests. By default, only some failures are retried. For example, connection failures and throttling failures can be retried. Resource not found (404) or authentication failures are not retried, because these are not likely to succeed on retry. If not set, the Storage Client uses an exponential backoff retry policy, where the wait time gets exponentially longer between requests, up to a total of around 30 seconds. The default retry policy is recommended for most scenarios.

Applies to