Circuitbreaker

Latest version: v1.4.0

Safety actively analyzes 618493 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.4.0

Big News
The `circuitbreaker` project has been classified as "Critical Project" on PyPI, meaning it belongs to the top 1% of all projects on PyPI based on the downloads over the last 6 months. We're working an important peace here 🙂

https://pypi.org/project/circuitbreaker/

Therefore a big _Thank You!_ to all contributors of this release!
:raised_hands: AugPro matthewhughes934 major pabs3 Freaky ozooxo xtaje :raised_hands:

Change Log

Fallback Function
By default, the circuit breaker will raise a ``CircuitBreaker`` exception when the circuit is opened. You can instead specify a function to be called when the circuit is opened. This function can be specified with the ``fallback_function`` parameter and will be called with the same parameters as the decorated function would be.

Custom callable for handling exceptions
The logic for handling thrown exceptions as failures can now be customized by passing a callable. The callable will be passed the exception type and value, and should return True if the exception should be treated as a failure.

Monotonic clock
Using the wall clock to measure durations is vulnerable to changes in the system clock causing misbehavior - a clock accidentally set far in the future and later reset could result in the circuit breaker remaining open for a great deal longer than expected. To solve this, a monotonic clock is now used for timing open states.

Circuitbreaker default name
The circuitbreaker default names are now taken from `__qualname__` if available for more precise default naming.


Fixes and tooling
- the project is now built on Github Action instead of Travis CI
- building for python 3.10
- applied smaller flake8 fixes

1.3.2

Not secure

1.2.0

Not secure
- New circuit breaker property `last_failure` allows accessing the last recorded exception (thanks luiscoms)
- Test library with Python 3.7 (thanks luiscoms)
- Fixed some typos in readme

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.