Skip to content

Commit

Permalink
conc: ddb-lock use backoff settings provided;
Browse files Browse the repository at this point in the history
  • Loading branch information
netsi committed Nov 16, 2023
1 parent 2acc3dd commit 0c32306
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/conc/ddb/ddb_lock_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,23 @@ func NewDdbLockProvider(ctx context.Context, config cfg.Config, logger log.Logge
return nil, fmt.Errorf("can not create ddb repository: %w", err)
}

backoffConfig := backoff.NewExponentialBackOff()
if settings.Backoff.InitialInterval > 0 {
backoffConfig.InitialInterval = settings.Backoff.InitialInterval
}

if settings.Backoff.MaxInterval > 0 {
backoffConfig.MaxInterval = settings.Backoff.MaxInterval
}

if settings.Backoff.MaxElapsedTime > 0 {
backoffConfig.MaxElapsedTime = settings.Backoff.MaxElapsedTime
}

return NewDdbLockProviderWithInterfaces(
logger,
repo,
backoff.NewExponentialBackOff(),
backoffConfig,
clock.NewRealClock(),
uuid.New(),
settings,
Expand Down

0 comments on commit 0c32306

Please sign in to comment.