Skip to main content

An exponential backoff iterator with collision avoidance.

Project description

Hello

Each iteration returns the total time (in seconds) to delay. It does this by increasing the maximum number of slots each iteration and then choosing a random number of slots between 0 and the maximum number of slots.

(See https://en.wikipedia.org/wiki/Exponential_backoff#Collision_avoidance)

Example:

import exponentional_backoff_ca

time_slot_secs = 2.0 # The number of seconds in each time slot.
num_iterations = 10  # The number of iterations.

exp_boff = ExponentialBackoff(time_slot_secs, num_iterations)

for interval in exp_boff:
    print(f"number of seconds in this slot is {interval}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exponential_backoff_ca-2.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

exponential_backoff_ca-2-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page