Class BackoffSettings
Backoff settings used within RetrySettings to implement exponential backoff.
Inheritance
Inherited Members
Namespace: Google.Api.Gax.Grpc
Assembly: Google.Api.Gax.Grpc.dll
Syntax
public sealed class BackoffSettings
Constructors
BackoffSettings(TimeSpan, TimeSpan, Double)
Creates a new instance with the specified settings.
Declaration
public BackoffSettings(TimeSpan delay, TimeSpan maxDelay, double delayMultiplier = 1)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | delay | The initial delay, either for the first retry or as the initial RPC timeout. |
System.TimeSpan | maxDelay | The maximum delay to use. If the increasing delay due to the delay multiplier exceeds this, this maximum is used instead. |
System.Double | delayMultiplier | The multiplier to apply to the delay on each iteration; must be greater than or equal to 1.0. Defaults to 1.0. |
Properties
Delay
The initial delay, either for the first retry or as the initial RPC timeout.
Declaration
public TimeSpan Delay { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
DelayMultiplier
The multiplier to apply to the delay on each iteration; must be greater than or equal to 1.0.
Declaration
public double DelayMultiplier { get; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
As an example, a multiplier of 2.0 with a delay of 0.1s on an RPC which fails three times before succeeding would lead to an initial delay between the first response and the second request of 0.1s; a delay between the second response and the third request of 0.2s, and a delay between the third response and the fourth request.
MaxDelay
The maximum delay to use. If the increasing delay due to the delay multiplier exceeds this, this maximum is used instead.
Declaration
public TimeSpan MaxDelay { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Methods
NextDelay(TimeSpan)
Works out the next delay from the current one, based on the multiplier and maximum.
Declaration
public TimeSpan NextDelay(TimeSpan currentDelay)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | currentDelay | The current delay to use as a basis for the next one. |
Returns
Type | Description |
---|---|
System.TimeSpan | The next delay to use, which is always at least Delay and at most MaxDelay. |