Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCircuitOpened = errors.New("restrix: circuit opened")
)
Functions ¶
This section is empty.
Types ¶
type Breaker ¶
type Breaker struct {
// contains filtered or unexported fields
}
Breaker object
func NewBreakerWithCustomSettings ¶
func NewBreakerWithCustomSettings(redisPool *redis.Pool, settings CircuitSettings) *Breaker
NewBreakerWithCustomSettings instantiate a new breaker with custom settings
type CircuitSettings ¶
type CircuitSettings struct { // RequestCountThreshold is the minimum number of requests needed cbefore a circuit can be tripped due to health RequestCountThreshold int `json:"request_volume_threshold"` // SleepWindow is how long to wait after a circuit opens before testing for recovery SleepWindow time.Duration `json:"sleep_window"` // ErrorPercentThreshold causes circuits to open once the rolling measure of errors exceeds this percent of requests ErrorPercentThreshold int `json:"error_percent_threshold"` // Interval which error percentage is calculated Interval time.Duration `json:"interval"` }
CircuitSettings is used to tune circuit settings at runtime
Click to show internal directories.
Click to hide internal directories.