Class MassiveRetryOptions
- Namespace
- MassiveDotNet
- Assembly
- MassiveDotNet.dll
Configures the SDK's bounded retry. Assign an instance to Retry to enable it; retry is off while that property is null.
public sealed class MassiveRetryOptions
- Inheritance
-
MassiveRetryOptions
- Inherited Members
Remarks
HTTP 429 and 5xx are retried, and so is a transport failure that describes the connection rather than an answer, such as a reset; MassiveRetryHandler lists the exact set. Every other 4xx describes a request that will fail again however many times it is sent, so retrying one spends quota to reach the same answer.
A timeout is not retried. Timeout bounds every attempt and every backoff of one call together, so a caller who wants a timed-out request retried makes a fresh call.
A request carrying content is never retried, since re-sending a consumed body is not guaranteed to succeed. Every route the SDK exposes is a GET, so this costs nothing today.
Properties
BackoffMultiplier
The factor each backoff is multiplied by for the following attempt. Defaults to 2.0.
Must be at least 1.0, since a shrinking backoff retries hardest when the server is
least able to answer.
public double BackoffMultiplier { get; set; }
Property Value
InitialBackoff
The backoff before the second attempt, doubled by BackoffMultiplier for each attempt after that and capped at MaxBackoff. Defaults to 500 milliseconds.
public Duration InitialBackoff { get; set; }
Property Value
MaxAttempts
The total number of attempts, including the first. Defaults to 3, so a failing
request is sent three times rather than four.
public int MaxAttempts { get; set; }
Property Value
MaxBackoff
The ceiling on a single backoff. Defaults to 30 seconds.
public Duration MaxBackoff { get; set; }
Property Value
Remarks
This also bounds how long a server's Retry-After is honoured. A hint longer than
this is not waited out: the 429 surfaces with
RetryAfter intact, so the caller decides
whether to wait rather than having their task held for a period the SDK did not choose.
UseJitter
Whether to spread each backoff randomly across the upper half of its computed value. Defaults to true.
public bool UseJitter { get; set; }
Property Value
Remarks
Without jitter, every client throttled by the same outage retries in lockstep and reconstructs the spike that caused it. The lower half of the interval is kept as a floor so a jittered backoff can still never approach zero.