The jitter.py module#

Summary#

get_expo_backoff

Get the backoff value.

Description#

Provides utilities for implementing exponential backoff with optional jitter.

This module is commonly used in retry mechanisms to handle transient errors in distributed systems.

Module detail#

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

Get the backoff value.

For more information, see Exponential Backoff And Jitter in the AWS documentation.

Parameters:
basefloat

Time to sleep in the first attempt.

attemptsint, default: 1

Number of attempts that have already been made.

capfloat, default: 100000000

Maximum value that can be returned.

jitterbool, default: True

Whether to apply jitter to the returned value.