Skip to main content

Fork of a popular backoff library with a few fixed bugs

Project description

improved_backoff

image image image image

image image image image

Function decoration for backoff and retry

This is a fork of an excellent Python library backoff. The library was forked on January 26, 2023. It includes the original version 2.2.1 (October 5, 2022) and a few extra updates.

This fork includes 2 PRs proposed in the original repo:

The updated behavior of max_time is that a a function will be retried only if the elapsed time is less, than max_time. Also the remaining time should exceed the interval (delay between retries).

The code that calculates delay time was modified to not generate negative values. If at the time of calculation elapsed time exceeds specified max_time value than delay is set to zero. If calculated delay time is negative, then it's also set to zero.

In order to use this module import it under backoff alias and use it the same way as the original module

import improved_backoff as backoff

@backoff.on_exception(backoff.expo, requests.exceptions.RequestException)
def get_url(url):
    return requests.get(url)

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

improved_backoff-1.2.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

improved_backoff-1.2-py3-none-any.whl (17.5 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