Skip to content

Commit 16d302f

Browse files
committed
add randomness
Signed-off-by: Hagar Meir <[email protected]>
1 parent 025ad75 commit 16d302f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

request/pool.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package request
99
import (
1010
"context"
1111
"fmt"
12+
"math/rand"
1213
"sync"
1314
"sync/atomic"
1415
"time"
@@ -101,7 +102,7 @@ func (rp *Pool) createPendingStore() *PendingStore {
101102
OnDelete: func(key string) {
102103
rp.semaphore.Release(1)
103104
},
104-
Epoch: rp.options.FirstStrikeThreshold / 10,
105+
Epoch: time.Duration(rand.Intn(50))*time.Millisecond + rp.options.FirstStrikeThreshold/10,
105106
FirstStrikeCallback: rp.striker.OnFirstStrikeTimeout,
106107
SecondStrikeCallback: rp.striker.OnSecondStrikeTimeout,
107108
}

0 commit comments

Comments
 (0)