Class ExponentialBackOff
Implementation of IBack
Implements
Inherited Members
Namespace: Google.Apis.Util
Assembly: Google.Apis.Core.dll
Syntax
public class ExponentialBackOff : IBackOff
Constructors
ExponentialBackOff()
Constructs a new exponential back-off with Delta
Declaration
public ExponentialBackOff()
ExponentialBackOff(TimeSpan, int)
Constructs a new exponential back-off with the given delta and maximum retries.
If unspecified, maximumNumOfRetries
is set to 10.
Declaration
public ExponentialBackOff(TimeSpan deltaBackOff, int maximumNumOfRetries = 10)
Parameters
Properties
DeltaBackOff
Time span used to bound the back-off jitter.
If the value is Zero then the generated back-off will be exactly 1, 2, 4,
8, 16, etc. seconds. A valid value is between zero and one second. The default value is 250ms, which means
that the generated back-off will be between 0.75sec and 1.25sec, 1.75sec and 2.25sec, 3.75sec and 4.25sec, and so on.
Only one of Delta
Declaration
public TimeSpan DeltaBackOff { get; }
Property Value
Type | Description |
---|---|
Time |
DeltaBackOffPercent
Percent of the current unjittered back-off used to bound the jitter.
If the value is set to 10, and the current back-off is 1000ms, then the jitter will be generated
from -100ms to 100ms and the jittered back-off will be from 900ms to 1100ms.
Only one of Delta
Declaration
public short DeltaBackOffPercent { get; }
Property Value
Type | Description |
---|---|
short |
MaxNumOfRetries
The maximum number of retries. Default value is 10
.
Declaration
public int MaxNumOfRetries { get; }
Property Value
Type | Description |
---|---|
int |
Methods
FromDeltaBackOffPercent(short, int)
Constructs a new exponential back-off with the given delta percent and maximum retries.
If unspecified, maximumNumOfRetries
is set to 10.
Declaration
public static ExponentialBackOff FromDeltaBackOffPercent(short deltaBackOffPercent, int maximumNumOfRetries = 10)
Parameters
Returns
Type | Description |
---|---|
Exponential |
GetNextBackOff(int)
Gets the a time span to wait before next retry. If the current retry reached the maximum number of retries,
the returned value is Min
Declaration
public TimeSpan GetNextBackOff(int currentRetry)
Parameters
Type | Name | Description |
---|---|---|
int | currentRetry |
Returns
Type | Description |
---|---|
Time |