typescript.circuit_breaker
Stability
High
Detects external service calls without circuit breaker protection.
Why It Matters
Section titled “Why It Matters”Missing circuit breakers:
- Cascade failures — One service down brings everything down
- Resource exhaustion — Threads blocked waiting
- No recovery — System stays broken after transient issues
Example
Section titled “Example”// ❌ Before (no circuit breaker)async function callPaymentService(payment: Payment): Promise<Receipt> { return axios.post('/api/payments', payment);}// ✅ After (with circuit breaker)import CircuitBreaker from 'opossum';
const breaker = new CircuitBreaker( async (payment: Payment) => axios.post('/api/payments', payment), { timeout: 3000, errorThresholdPercentage: 50, resetTimeout: 30000, });
async function callPaymentService(payment: Payment): Promise<Receipt> { return breaker.fire(payment);}What Unfault Detects
Section titled “What Unfault Detects”- HTTP clients without circuit breakers
- gRPC calls without protection
- Database calls without failover
Auto-Fix
Section titled “Auto-Fix”Unfault can add opossum circuit breaker wrapper.