Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions circuitbreaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
// 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.
//
package circuit

import (
Expand All @@ -37,7 +34,7 @@ import (
"sync/atomic"
"time"

"github.com/cenkalti/backoff"
"github.com/cenkalti/backoff/v5"
"github.com/facebookgo/clock"
)

Expand Down Expand Up @@ -74,7 +71,6 @@ const (

var (
defaultInitialBackOffInterval = 500 * time.Millisecond
defaultBackoffMaxElapsedTime = 0 * time.Second
)

// Error codes returned by Call
Expand Down Expand Up @@ -139,8 +135,6 @@ func NewBreakerWithOptions(options *Options) *Breaker {
if options.BackOff == nil {
b := backoff.NewExponentialBackOff()
b.InitialInterval = defaultInitialBackOffInterval
b.MaxElapsedTime = defaultBackoffMaxElapsedTime
b.Clock = options.Clock
b.Reset()
options.BackOff = b
}
Expand Down
2 changes: 1 addition & 1 deletion circuitbreaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff"
"github.com/cenkalti/backoff/v5"
"github.com/facebookgo/clock"
)

Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/rubyist/circuitbreaker
module github.com/rubyist/circuitbreaker/v2

go 1.21.6
go 1.23

require (
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect
github.com/cenkalti/backoff/v5 v5.0.2
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw=
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA=
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea h1:sKwxy1H95npauwu8vtF95vG/syrL0p8fSZo/XlDg5gk=
Expand Down
2 changes: 1 addition & 1 deletion panel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestPanelGet(t *testing.T) {
t.Errorf("Expected ok to be true")
}

a, ok = p.Get("missing")
_, _ = p.Get("missing")
}

func TestPanelAdd(t *testing.T) {
Expand Down