Skip to content

Commit 2883214

Browse files
committed
Document that the generator function must be safe for concurrent use
1 parent 2abc063 commit 2883214

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rehttp.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// return a DelayFn:
1212
// - ConstDelay(delay time.Duration) DelayFn
1313
// - ExpJitterDelay(base, max time.Duration) DelayFn
14+
// - ExpJitterDelayWithRand(base, max time.Duration, generator func(int64) int64) DelayFn
1415
//
1516
// It also provides common retry helpers that return a RetryFn:
1617
// - RetryIsErr(func(error) bool) RetryFn
@@ -270,6 +271,8 @@ func ExpJitterDelay(base, max time.Duration) DelayFn {
270271
// between 0 and base * 2^attempt capped at max (an exponential
271272
// backoff delay with jitter). The generator argument is expected
272273
// to generate a random int64 in the half open interval [0, n).
274+
// It is the caller's responsibility to ensure that the function is
275+
// safe for concurrent use.
273276
//
274277
// See the full jitter algorithm in:
275278
// http://www.awsarchitectureblog.com/2015/03/backoff.html

0 commit comments

Comments
 (0)