You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use "full jitter" & updated base delay for STANDARD retry mode defaults (#2648)
* Use "full jitter" & updated base delay for STANDARD retry mode defaults
## Motivation and Context
The STANDARD retry mode has standardized behavior across the SDKs. This
includes using "full jitter" backoff (i.e., 0-100% of the computed
delay) for both normal and throttling errors. The standard behavior also
uses a base delay of 1 second.
## Modifications
* Update BackoffStrategy's `defaultStrategy` and
`defaultThrottlingStrategy` methods to accept a `RetryMode`. The
`RetryMode` will be used to resolve the default jitter strategy ("full"
vs. "equal") as well as the base delay (the max backoff time does not
vary between modes).
* Define additional constants in SdkDefaultRetrySetting to support the
update base delay values. (Note: This includes backwards-incompatible
changes but the class is annotated @SdkInternalApi.)
* Update RetryPolicy to use the new methods.
* Add tests to RetryPolicyTest to ensure that it is resolving to the
correct strategy and values.
* Add new unit test class for FullJitterBackoffStrategy. This confirms
that full jitter is consistent with the standard retry behavior.
* Update FullJitterBackoffStrategy to add 1 ms to the random result.
This both allows us to reach our maximum value (since the random
parameter is exclusive) and ensures we always have a delay of at least 1
ms (which is consistent with BackoffStrategy.none()'s behavior).
0 commit comments