Skip to content

Commit

Permalink
retryer: increase max retry interval from 1 min to 30 min
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fho committed Jan 12, 2022
1 parent 71cf5f0 commit b54ba85
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/goordinator/retryer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
defBackoffInitialInterval = 5 * time.Second
defBackoffRandomizationFactor = 0.5
defBackoffMaxElapsedTime = 0 // disabled, max retry time is controlled via ctx
defBackoffMaxInterval = 30 * time.Minute
)

// Retryer executes a function repeatedly until it was successful or it's
Expand All @@ -31,6 +32,7 @@ type Retryer struct {
backoffInitialInterval time.Duration
backoffRandomizationFactor float64
backoffMaxElapsedTime time.Duration
backoffMaxInterval time.Duration
}

func NewRetryer() *Retryer {
Expand All @@ -41,6 +43,7 @@ func NewRetryer() *Retryer {
backoffInitialInterval: defBackoffInitialInterval,
backoffRandomizationFactor: defBackoffRandomizationFactor,
backoffMaxElapsedTime: defBackoffMaxElapsedTime,
backoffMaxInterval: defBackoffMaxInterval,
}
}

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

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

Expand Down

0 comments on commit b54ba85

Please sign in to comment.