Skip to content

Commit 3e782b7

Browse files
committed
Remove needless mutex
See #499
1 parent 6782699 commit 3e782b7

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

backoff.go

-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func (b *ConstantBackoff) Next(retry int) (time.Duration, bool) {
6767
// ExponentialBackoff implements the simple exponential backoff described by
6868
// Douglas Thain at http://dthain.blogspot.de/2009/02/exponential-backoff-in-distributed.html.
6969
type ExponentialBackoff struct {
70-
sync.Mutex
7170
t float64 // initial timeout (in msec)
7271
f float64 // exponential factor (e.g. 2)
7372
m float64 // maximum timeout (in msec)
@@ -86,9 +85,6 @@ func NewExponentialBackoff(initialTimeout, maxTimeout time.Duration) *Exponentia
8685

8786
// Next implements BackoffFunc for ExponentialBackoff.
8887
func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool) {
89-
b.Lock()
90-
defer b.Unlock()
91-
9288
r := 1.0 + rand.Float64() // random number in [1..2]
9389
m := math.Min(r*b.t*math.Pow(b.f, float64(retry)), b.m)
9490
if m >= b.m {

0 commit comments

Comments
 (0)