Package Usage: go: github.com/rubyist/circuitbreaker
Package circuit implements the Circuit Breaker pattern. It will wrap
a function call (typically one which uses remote services) and monitors for
failures and/or time outs. When a threshold of failures or time outs has been
reached, future calls to the function will not run. During this state, the
breaker will periodically allow the function to run and, if it is successful,
will start running the function again.
Circuit includes three types of circuit breakers:
A Threshold Breaker will trip when the failure count reaches a given threshold.
It does not matter how long it takes to reach the threshold and the failures do
not need to be consecutive.
A Consecutive Breaker will trip when the consecutive failure count reaches a given
threshold. It does not matter how long it takes to reach the threshold, but the
failures do need to be consecutive.
When wrapping blocks of code with a Breaker's Call() function, a time out can be
specified. If the time out is reached, the breaker's Fail() function will be called.
Other types of circuit breakers can be easily built by creating a Breaker and
adding a custom TripFunc. A TripFunc is called when a Breaker Fail()s and receives
the breaker as an argument. It then returns true or false to indicate whether the
breaker should trip.
The package also provides a wrapper around an http.Client that wraps all of
the http.Client functions with a Breaker.
17 versions
Latest release: about 8 years ago
163 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/rubyist/circuitbreaker
Dependent Repos 1
tchapgouv/matrix-media-repo Fork of t2bot/matrix-media-repo
Matrix media repository with multi-domain in mind.Size: 6.2 MB - Last synced: 7 days ago - Pushed: over 1 year ago
