Description
Implement a circuit breaker around the Vercel API client to prevent cascading failures during Vercel outages, failing fast when the API is unhealthy and recovering automatically when it stabilizes.
Requirements and Context
- Reliability: Circuit breaker must have closed, open, and half-open states
- Testing: Test all circuit breaker state transitions
- Documentation: Document the circuit breaker configuration
Suggested Execution
Branch: feat/issue-052-vercel-circuit-breaker
Implement Changes
- Implement a circuit breaker wrapper around
apps/backend/src/services/vercel.service.ts
- Open the circuit after a configurable failure threshold and fail fast
- Transition to half-open after a cooldown and test recovery with a probe request
- Emit metrics/logs on circuit state transitions
Test and Commit
- Test closed→open, open→half-open, and half-open→closed transitions
- Test fail-fast behavior when the circuit is open
- Document circuit breaker thresholds and cooldown values
Example Commit Message
feat(vercel): add circuit breaker for external API resilience
- Implement circuit breaker with closed/open/half-open states
- Fail fast when Vercel API is unhealthy
- Emit logs on circuit state transitions
Guidelines
- Make thresholds and cooldown configurable via environment variables
- Ensure the circuit breaker is thread-safe under concurrency
- Log state transitions with correlation IDs
Description
Implement a circuit breaker around the Vercel API client to prevent cascading failures during Vercel outages, failing fast when the API is unhealthy and recovering automatically when it stabilizes.
Requirements and Context
Suggested Execution
Branch:
feat/issue-052-vercel-circuit-breakerImplement Changes
apps/backend/src/services/vercel.service.tsTest and Commit
Example Commit Message
Guidelines