From fb1db0d3e7eee857f720249469b5a09ac5263aa4 Mon Sep 17 00:00:00 2001 From: Kamil Samigullin Date: Sun, 17 Feb 2019 17:00:41 +0300 Subject: [PATCH] fix #125: remove strategy.Infinite --- strategy/strategy.go | 7 ------- strategy/strategy_test.go | 13 ------------- 2 files changed, 20 deletions(-) diff --git a/strategy/strategy.go b/strategy/strategy.go index 76e5362..352d7a6 100644 --- a/strategy/strategy.go +++ b/strategy/strategy.go @@ -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 { diff --git a/strategy/strategy_test.go b/strategy/strategy_test.go index cf1ef86..a2129ba 100644 --- a/strategy/strategy_test.go +++ b/strategy/strategy_test.go @@ -1,7 +1,6 @@ package strategy_test import ( - "math" "testing" "time" @@ -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