Skip to content

Clone of a popular litl/backoff library with a few fixes

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.backoff
Notifications You must be signed in to change notification settings

Kirusi/improved_backoff

 
 

Repository files navigation

improved_backoff

image 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.

The work in this repo was motivated by the following PRs that were proposed in the original repo:

The updated behavior of max_time is that 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)

About

Clone of a popular litl/backoff library with a few fixes

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.backoff

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%