{"repo":"sony/gobreaker","free":true,"listed":false,"github":"https://github.com/sony/gobreaker","clone":"git clone https://github.com/sony/gobreaker.git","description":"Circuit Breaker implemented in Go","language":"Go","stars":3681,"topics":["golang","circuit-breaker","microservice"],"license":"MIT","category":"dev-tools","readme_excerpt":"gobreaker ========= [gobreaker][repo-url] implements the Circuit Breaker pattern in Go. Installation ------------ Usage ----- The struct CircuitBreaker is a state machine to prevent sending requests that are likely to fail. The function NewCircuitBreaker creates a new CircuitBreaker . The type parameter T specifies the return type of requests. You can configure CircuitBreaker using the struct Settings : - Name is the name of the CircuitBreaker . - MaxRequests is the maximum number of requests allowed to pass through when the CircuitBreaker is half-open. If MaxRequests is 0, CircuitBreaker allows only 1 request. - Interval is the cyclic period of the closed state for CircuitBreaker to clear the internal Counts , described later in this section. If Interval is 0, CircuitBreaker does not clear the internal Counts during the closed state. - BucketPeriod defines the time duration for each bucket in the rolling window strategy. The internal Counts will be updated and reset gradually for each bucket. Interval will be automatically adjusted to be a multiple of BucketPeriod . If BucketPeriod is less than or equal to 0, CircuitBreaker will use a fixed window strategy instead. - Timeout is the period of the open state, after which the state of CircuitBreaker becomes half-open. If Timeout is 0, the timeout value of CircuitBreaker is set to 60 seconds. - ReadyToTrip is called with a copy of Counts whenever a request fails in the closed state. If ReadyToTrip returns true, CircuitBreaker wi","default_branch":null,"files":null,"tree":[],"storefront":"/r/sony","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sony/gobreaker/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}