Release Notes: Protego Circuit Breaker - Version 1.0.0
New Features
-
Dynamic Circuit Breaker Configuration:
- Protego introduces a highly flexible and dynamic circuit breaker that can be configured for failure thresholds, reset timeouts, and retries directly through view decorators.
-
Centralized Registry for Circuit Breakers:
- Circuit Breaker instances are stored in a centralized registry (
ProtegoRegistry
) ensuring only one instance per application, simplifying global configuration and management of circuit breakers.
- Circuit Breaker instances are stored in a centralized registry (
-
Decorator-based API for Circuit Breaking:
- The
@protego.protect
decorator can now be easily applied to Django views or functions to automatically apply circuit-breaking behavior to the endpoints.
- The
-
Customizable Circuit Breaker Behavior:
- Parameters such as
failure_threshold
,reset_timeout
, andhalf_open_retries
can be customized for each view, ensuring that the circuit breaker behavior fits the needs of each service endpoint.
- Parameters such as
Bug Fixes
-
Improved Handling of Failure States:
- Ensured that the circuit breaker correctly enters a "half-open" state after a configured reset timeout, allowing for retries before fully closing the circuit.
-
Graceful Error Handling:
- When a circuit breaker is triggered, responses are now returned with a
503 Service Unavailable
status and a user-friendly message.
- When a circuit breaker is triggered, responses are now returned with a
Breaking Changes
- None
Configuration
- Use the
@protego.protect
decorator in your views to enable circuit-breaking:
from protego import protego
@protego.protect(failure_threshold=5, reset_timeout=30, half_open_retries=2)
def my_view(request):
# Your view logic here
Installation Instructions
pip install git+https://github.com/grandimam/django-protego.git@main