Skip to content

Commit b54ba85

Browse files
Fabian Hollerfho
Fabian Holler
authored andcommitted
retryer: increase max retry interval from 1 min to 30 min
Goordinator retries failed actions by default for up to 24h. The backoff interval timer had a max. Interval of 1min set. Increase it to 30min, retrying every minute is Unnecessarily often with such a big retry timeout.
1 parent 71cf5f0 commit b54ba85

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/goordinator/retryer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const (
2020
defBackoffInitialInterval = 5 * time.Second
2121
defBackoffRandomizationFactor = 0.5
2222
defBackoffMaxElapsedTime = 0 // disabled, max retry time is controlled via ctx
23+
defBackoffMaxInterval = 30 * time.Minute
2324
)
2425

2526
// Retryer executes a function repeatedly until it was successful or it's
@@ -31,6 +32,7 @@ type Retryer struct {
3132
backoffInitialInterval time.Duration
3233
backoffRandomizationFactor float64
3334
backoffMaxElapsedTime time.Duration
35+
backoffMaxInterval time.Duration
3436
}
3537

3638
func NewRetryer() *Retryer {
@@ -41,6 +43,7 @@ func NewRetryer() *Retryer {
4143
backoffInitialInterval: defBackoffInitialInterval,
4244
backoffRandomizationFactor: defBackoffRandomizationFactor,
4345
backoffMaxElapsedTime: defBackoffMaxElapsedTime,
46+
backoffMaxInterval: defBackoffMaxInterval,
4447
}
4548
}
4649

@@ -66,6 +69,7 @@ func (r *Retryer) Run(ctx context.Context, fn func(context.Context) error, logF
6669
bo.InitialInterval = r.backoffInitialInterval
6770
bo.RandomizationFactor = r.backoffRandomizationFactor
6871
bo.MaxElapsedTime = r.backoffMaxElapsedTime
72+
bo.MaxInterval = r.backoffMaxInterval
6973

7074
logger := r.logger.With(logF...)
7175

0 commit comments

Comments
 (0)