Skip to content

Commit

Permalink
Document that the generator function must be safe for concurrent use
Browse files Browse the repository at this point in the history
  • Loading branch information
mna committed Mar 2, 2024
1 parent 2abc063 commit 2883214
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rehttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// return a DelayFn:
// - ConstDelay(delay time.Duration) DelayFn
// - ExpJitterDelay(base, max time.Duration) DelayFn
// - ExpJitterDelayWithRand(base, max time.Duration, generator func(int64) int64) DelayFn
//
// It also provides common retry helpers that return a RetryFn:
// - RetryIsErr(func(error) bool) RetryFn
Expand Down Expand Up @@ -270,6 +271,8 @@ func ExpJitterDelay(base, max time.Duration) DelayFn {
// between 0 and base * 2^attempt capped at max (an exponential
// backoff delay with jitter). The generator argument is expected
// to generate a random int64 in the half open interval [0, n).
// It is the caller's responsibility to ensure that the function is
// safe for concurrent use.
//
// See the full jitter algorithm in:
// http://www.awsarchitectureblog.com/2015/03/backoff.html
Expand Down

0 comments on commit 2883214

Please sign in to comment.