File tree 2 files changed +3
-4
lines changed
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,16 @@ const (
74
74
75
75
// NewExponentialBackOff creates an instance of ExponentialBackOff using default values.
76
76
func NewExponentialBackOff () * ExponentialBackOff {
77
- return & ExponentialBackOff {
77
+ b := & ExponentialBackOff {
78
78
InitialInterval : DefaultInitialInterval ,
79
79
RandomizationFactor : DefaultRandomizationFactor ,
80
80
Multiplier : DefaultMultiplier ,
81
81
MaxInterval : DefaultMaxInterval ,
82
82
MaxElapsedTime : DefaultMaxElapsedTime ,
83
83
Clock : SystemClock ,
84
84
}
85
+ b .Reset ()
86
+ return b
85
87
}
86
88
87
89
type systemClock struct {}
Original file line number Diff line number Diff line change @@ -77,9 +77,6 @@ func TestGetElapsedTime(t *testing.T) {
77
77
func TestMaxElapsedTime (t * testing.T ) {
78
78
var exp = NewExponentialBackOff ()
79
79
exp .Clock = & TestClock {start : time.Time {}.Add (10000 * time .Second )}
80
- if exp .NextBackOff () != Stop {
81
- t .Error ("error2" )
82
- }
83
80
// Change the currentElapsedTime to be 0 ensuring that the elapsed time will be greater
84
81
// than the max elapsed time.
85
82
exp .startTime = time.Time {}
You can’t perform that action at this time.
0 commit comments