Skip to content

Commit

Permalink
feat: Use adaptive retryer in order to try to better handle rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Apr 19, 2024
1 parent 50190bf commit a066651
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion exporter/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/health"
)
Expand Down Expand Up @@ -78,7 +79,12 @@ func newAWSConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error
return aws.Config{}, fmt.Errorf("Please configure the AWS_REGION environment variable")
}

cfg, err := config.LoadDefaultConfig(ctx, optFns...)
optf := append(optFns,
config.WithRetryer(func() aws.Retryer {
return retry.NewAdaptiveMode()
}),
)
cfg, err := config.LoadDefaultConfig(ctx, optf...)
if err != nil {
return aws.Config{}, err
}
Expand Down

0 comments on commit a066651

Please sign in to comment.