Class BackoffStrategy
- Namespace
- OpenPolicyAgent.Opa.OpenApi.Utils.Retries
- Assembly
- OpenPolicyAgent.Opa.dll
public class BackoffStrategy
- Inheritance
-
BackoffStrategy
- Inherited Members
Constructors
BackoffStrategy(long, long, long, double, double)
Configures the exponential backoff strategy.
public BackoffStrategy(long initialIntervalMs, long maxIntervalMs, long maxElapsedTimeMs, double exponent, double jitterFactor = 0.5)
Parameters
initialIntervalMslongThe initial interval in milliseconds.
maxIntervalMslongThe maximum interval in milliseconds.
maxElapsedTimeMslongThe maximum elapsed time in milliseconds.
exponentdoubleThe base factor used to compute the exponential interval
jitterFactordoubleThe jitter factor used to randomize the backoff interval
Remarks
The duration between consecutive attempts is calculated as follows: intervalMs = min(maxIntervalMs, initialIntervalMs*(baseFactor^attempts) +/- r) where baseFactor (also referred to as "exponent") is the multiplicative factor and r a random value between 0 and jitterFactor*intervalMs.
Fields
BaseFactor
public readonly double BaseFactor
Field Value
InitialIntervalMs
public readonly long InitialIntervalMs
Field Value
JitterFactor
public readonly double JitterFactor
Field Value
MaxElapsedTimeMs
public readonly long MaxElapsedTimeMs
Field Value
MaxIntervalMs
public readonly long MaxIntervalMs