Skip to main content

get_exponential_backoff_interval

Calculate the exponential backoff wait time.

def get_exponential_backoff_interval(
factor: int,
retries: int,
maximum: int,
full_jitter: boolean = False
) - > int

Calculate the exponential backoff wait time.

Parameters

NameTypeDescription
factorintThe base multiplier used to scale the initial wait time.
retriesintThe number of retry attempts already made, used as the exponent for the backoff calculation.
maximumintThe upper bound limit for the wait time to prevent excessively long delays.
full_jitterboolean = FalseWhether to apply a random distribution to the wait time to prevent thundering herd problems.

Returns

TypeDescription
intThe calculated wait time in seconds or milliseconds, capped by the maximum value and never less than zero.