//------------------------------------------------------------------------------
//
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
//
//------------------------------------------------------------------------------
#nullable enable
namespace LukeHagar.PlexAPI.SDK.Utils.Retries
{
public class BackoffStrategy
{
public readonly long InitialIntervalMs;
public readonly long MaxIntervalMs;
public readonly long MaxElapsedTimeMs;
public readonly double BaseFactor;
public readonly double JitterFactor;
///
/// Configures the exponential backoff strategy.
///
///
/// 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.
///
/// The initial interval in milliseconds.
/// The maximum interval in milliseconds.
/// The maximum elapsed time in milliseconds.
/// The base factor used to compute the exponential interval
/// The jitter factor used to randomize the backoff interval
public BackoffStrategy(long initialIntervalMs,
long maxIntervalMs,
long maxElapsedTimeMs,
double exponent,
double jitterFactor = 0.5)
{
InitialIntervalMs = initialIntervalMs;
MaxIntervalMs = maxIntervalMs;
MaxElapsedTimeMs = maxElapsedTimeMs;
BaseFactor = exponent;
JitterFactor = jitterFactor;
}
}
}