Skip to content

Commit

Permalink
Merge pull request #1045 from hashicorp/f-configurable-retry.BackoffD…
Browse files Browse the repository at this point in the history
…elayer

Add configurable `retry.BackoffDelayer`
  • Loading branch information
ewbankkit committed May 9, 2024
2 parents fccf6cb + d88efef commit f532d35
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<!-- markdownlint-disable single-title -->
# v2.0.0 (Unreleased)

# v2.0.0-beta.53 (2024-05-09)

BUG FIXES

* Updates dependencies.

ENHANCEMENTS

* Adds `Backoff` parameter to configure the backoff strategy the retryer will use to determine the delay between retry attempts ([#1045](https://github.com/hashicorp/aws-sdk-go-base/pull/1045))

# v2.0.0-beta.52 (2024-04-11)

BUG FIXES
Expand Down
6 changes: 6 additions & 0 deletions aws_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ func resolveRetryer(ctx context.Context, c *Config, awsConfig *aws.Config) {

var standardOptions []func(*retry.StandardOptions)

if backoff := c.Backoff; backoff != nil {
standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
so.Backoff = backoff
})
}

if v, found, _ := awsconfig.GetRetryMaxAttempts(ctx, awsConfig.ConfigSources); found && v != 0 {
standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
so.MaxAttempts = v
Expand Down
2 changes: 2 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/retry"
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
"github.com/aws/aws-sdk-go-v2/feature/ec2/imds"
"github.com/hashicorp/aws-sdk-go-base/v2/diag"
Expand All @@ -34,6 +35,7 @@ type Config struct {
APNInfo *APNInfo
AssumeRole *AssumeRole
AssumeRoleWithWebIdentity *AssumeRoleWithWebIdentity
Backoff retry.BackoffDelayer
CallerDocumentationURL string
CallerName string
CustomCABundle string
Expand Down
2 changes: 1 addition & 1 deletion v2/awsv1shim/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1
github.com/aws/aws-sdk-go-v2/service/sts v1.28.7
github.com/google/go-cmp v0.6.0
github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52
github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/terraform-plugin-log v0.9.0
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0
Expand Down

0 comments on commit f532d35

Please sign in to comment.