CircuitBreakerConfig
data class CircuitBreakerConfig(val failureThreshold: Int = 5, val resetTimeout: Duration = 30.seconds)(source)
Circuit breaker that stops retries when failures exceed a threshold.
Prevents cascading failures by "opening" the circuit after failureThreshold consecutive failures within resetTimeout. While open, requests fail immediately with com.github.ayastrebov.volvo.api.exception.RateLimitException instead of hitting the server.
After resetTimeout elapses, the circuit moves to "half-open" and allows one request through. If it succeeds, the circuit closes. If it fails, it opens again.
VolvoCarsConfig(
apiKey = "your-key",
token = "your-token",
circuitBreaker = CircuitBreakerConfig(
failureThreshold = 5,
resetTimeout = 60.seconds
)
)Content copied to clipboard