Skip to content

[FEATURE REQ] RetryPolicy / RetryOptions - configurable exponent & random boundaries and/or custom retry mode (user provided CalculateExponentialDelay) #34611

Closed
@ohads-MSFT

Description

Library name

Azure.Core

Please describe the feature.

Consider the existing method for calculating exponential backoff delay:

(1 << (attempted - 1)) * _random.Next((int)(_delay.TotalMilliseconds * 0.8), (int)(_delay.TotalMilliseconds * 1.2)),

As you can see, the following are hard-coded:

  1. Exponent 1 << basically means Math.Pow(2, attempt - 1) (so it's set to 2)
  2. Lower random boundary (0.8)
  3. Upper random boundary (1.2)

The exponent especially can be critical to the resulting delay time series, but since exposing all the above seems very simple (basically add 3 properties to RetryOptions), might as well add them too.

In addition, a RetryMode.Custom could be added which allows setting a custom-provided CalculateExponentialDelay. I suppose if we have this kind of extensibility then parametrizing the above properties won't be strictly needed, but IMHO it would be nice to have all the same (e.g. the Azure.Core team might improve the method yet retain the constants used, for example guard better against overflow).

Metadata

Assignees

Labels

Azure.CoreClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions