File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ package waitfor
22
33import (
44 "time"
5-
6- "github.com/cenkalti/backoff/v5"
75)
86
97type (
@@ -29,13 +27,15 @@ type (
2927// - interval: 5 seconds
3028// - maxInterval: 60 seconds
3129// - attempts: 5.
30+ // - multiplier: 1.5
31+ // - randomizationFactor: 0.5
3232func newOptions (setters []Option ) * options {
3333 opts := & options {
3434 interval : time .Duration (5 ) * time .Second ,
3535 maxInterval : time .Duration (60 ) * time .Second ,
3636 attempts : 5 ,
37- multiplier : backoff . DefaultMultiplier ,
38- randomizationFactor : backoff . DefaultRandomizationFactor ,
37+ multiplier : 1.5 ,
38+ randomizationFactor : 0.5 ,
3939 }
4040
4141 for _ , setter := range setters {
@@ -101,6 +101,10 @@ func WithMultiplier(multiplier float64) Option {
101101// exponential backoff. This factor introduces jitter to the retry intervals,
102102// helping to prevent thundering herd problems when multiple clients are retrying
103103// simultaneously.
104+ //
105+ // Example:
106+ //
107+ // runner.Test(ctx, resources, waitfor.WithRandomizationFactor(0.5)) // 50% jitter
104108func WithRandomizationFactor (factor float64 ) Option {
105109 return func (opts * options ) {
106110 opts .randomizationFactor = factor
You can’t perform that action at this time.
0 commit comments