Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 821 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 821 Bytes

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