Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: (core) Add circuit breaker pattern for database operations #810

Closed

Conversation

augchan42
Copy link
Contributor

Related to #719

This PR implements the circuit breaker pattern directly in DatabaseAdapter as discussed in the previous PR.

Implements circuit breaker pattern to handle database failures gracefully and prevent cascading failures. Fixes #712.

Changes:

Adds CircuitBreaker class with CLOSED, OPEN, and HALF-OPEN states
Introduces BaseCircuitBreakerAdapter for database adapters
Configurable failure thresholds and recovery timeouts
Automatic recovery attempts in HALF-OPEN state
Detailed logging of circuit breaker state changes
Circuit breaker configuration:

Opens after 5 consecutive failures (configurable)
Resets after 60 seconds in OPEN state
Requires 3 successful operations in HALF-OPEN state to close
This helps prevent overwhelming failed database connections and provides graceful degradation during outages.

@augchan42
Copy link
Contributor Author

closing due to upstream changes again

@augchan42 augchan42 closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Add circuit breaker pattern for database operations
1 participant