Skip to content

dahernan/breaker

Repository files navigation

Circuit Breaker Implementation in Go

How to use

b, err := NewBreaker(OptionsDefaults())

err = b.Call(func() error {
	// do my logic
	return nil
})

if err == ErrBreakerOpen {
	// the circuit is open
}

Default circuit values when you create a breaker

// OptionsDefaults
// ErrorsPercentage - 50 - If number_of_errors / total_calls * 100 > 50.0 the circuit will be open
// MinimumNumberOfRequest - if total_calls < 20 the circuit will be close
// NumberOfSecondsToStore - 20 seconds

About

Circuit breaker implementation in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages