You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Aditya Manthramurthy 8e6e9301ce Add support for Kafka as a notifications target (#2869) (#3439) 8 years ago
..
README.md Add support for Kafka as a notifications target (#2869) (#3439) 8 years ago
breaker.go Add support for Kafka as a notifications target (#2869) (#3439) 8 years ago

README.md

circuit-breaker

Build Status GoDoc Code of Conduct

The circuit-breaker resiliency pattern for golang.

Creating a breaker takes three parameters:

  • error threshold (for opening the breaker)
  • success threshold (for closing the breaker)
  • timeout (how long to keep the breaker open)
b := breaker.New(3, 1, 5*time.Second)

for {
	result := b.Run(func() error {
		// communicate with some external service and
		// return an error if the communication failed
		return nil
	})

	switch result {
	case nil:
		// success!
	case breaker.ErrBreakerOpen:
		// our function wasn't run because the breaker was open
	default:
		// some other error
	}
}