Skip to content

Commit

Permalink
fix #125: remove strategy.Infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Feb 17, 2019
1 parent a776414 commit fb1db0d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
7 changes: 0 additions & 7 deletions strategy/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ import (
// made. This allows for a pre-action delay, etc.
type Strategy func(attempt uint, err error) bool

// Infinite creates a Strategy that will never stop repeating.
func Infinite() Strategy {
return func(attempt uint, _ error) bool {
return true
}
}

// Limit creates a Strategy that limits the number of attempts that Retry will
// make.
func Limit(attemptLimit uint) Strategy {
Expand Down
13 changes: 0 additions & 13 deletions strategy/strategy_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package strategy_test

import (
"math"
"testing"
"time"

Expand All @@ -12,18 +11,6 @@ import (
// a time-based (sleep) unit before considering invalid.
const timeMarginOfError = time.Millisecond

func TestInfinite(t *testing.T) {
policy := Infinite()

if !policy(0, nil) {
t.Error("strategy expected to return true")
}

if !policy(math.MaxUint32, nil) {
t.Error("strategy expected to return true")
}
}

func TestLimit(t *testing.T) {
const attemptLimit = 3

Expand Down

0 comments on commit fb1db0d

Please sign in to comment.