client.utils.jitter#

This module provides utilities for implementing exponential backoff with optional jitter, commonly used in retry mechanisms to handle transient errors in distributed systems.

Functions#

get_expo_backoff(base[, attempts, cap, attempts_cap, ...])

Returns a backoff value https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

Module Contents#

client.utils.jitter.get_expo_backoff(base: float, attempts: int = 1, cap: float = 100000000, attempts_cap: int = 100000000, jitter: bool = True)#

Returns a backoff value https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ :param base: The time to sleep in the first attempt. :param attempts: The number of attempts that have already been made. :param cap: The maximum value that can be returned. :param jitter: Whether or not to apply jitter to the returned value.