persona-community-2/pkg/textgen/circuit_breaker.go
jordan cb3d4d5786
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
Initialize project from skeleton template
2026-02-23 10:53:55 +00:00

29 lines
904 B
Go

package textgen
import (
"time"
"git.threesix.ai/jordan/persona-community-2/pkg/routing"
)
// CircuitBreaker is an alias for routing.CircuitBreaker.
//
// IMPORTANT: All cooldown tracking logic is implemented in pkg/routing.
// Do NOT implement custom cooldown logic here. Use routing.CircuitBreaker
// directly for new code.
type CircuitBreaker = routing.CircuitBreaker
// Cooldown period constants - re-exported from routing for convenience.
const (
// DefaultCooldownPeriod is the cooldown for rate limits and quota errors.
DefaultCooldownPeriod = routing.DefaultCooldownPeriod
// TransientCooldownPeriod is the cooldown for transient server errors (503, 500, etc).
TransientCooldownPeriod = routing.TransientCooldownPeriod
)
// NewCircuitBreaker creates a new circuit breaker.
func NewCircuitBreaker(cooldown time.Duration) *CircuitBreaker {
return routing.NewCircuitBreaker(cooldown)
}