Skip to content

Commit

Permalink
rename WithMaxTries to WithMaxRetries; fix #52; fix #54
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Dec 24, 2017
1 parent 309aa71 commit 2ea60e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tries.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package backoff
import "time"

/*
WithMaxTries creates a wrapper around another BackOff, which will
WithMaxRetries creates a wrapper around another BackOff, which will
return Stop if NextBackOff() has been called too many times since
the last time Reset() was called
Note: Implementation is not thread-safe.
*/
func WithMaxTries(b BackOff, max uint64) BackOff {
func WithMaxRetries(b BackOff, max uint64) BackOff {
return &backOffTries{delegate: b, maxTries: max}
}

Expand Down
4 changes: 2 additions & 2 deletions tries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestMaxTriesHappy(t *testing.T) {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
max := 17 + r.Intn(13)
bo := WithMaxTries(&ZeroBackOff{}, uint64(max))
bo := WithMaxRetries(&ZeroBackOff{}, uint64(max))

// Load up the tries count, but reset should clear the record
for ix := 0; ix < max/2; ix++ {
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestMaxTriesHappy(t *testing.T) {

func TestMaxTriesZero(t *testing.T) {
// It might not make sense, but its okay to send a zero
bo := WithMaxTries(&ZeroBackOff{}, uint64(0))
bo := WithMaxRetries(&ZeroBackOff{}, uint64(0))
for ix := 0; ix < 11; ix++ {
d := bo.NextBackOff()
if d == Stop {
Expand Down

0 comments on commit 2ea60e5

Please sign in to comment.