-
Notifications
You must be signed in to change notification settings - Fork 734
Open
Labels
documentationThis is a problem with documentation.This is a problem with documentation.queuedThis issues is on the AWS team's backlogThis issues is on the AWS team's backlog
Description
Acknowledgements
- I have searched (https://github.com/aws/aws-sdk/issues?q=is%3Aissue) for past instances of this issue
- I have verified all of my SDK modules are up-to-date (you can perform a bulk update with
go get -u github.com/aws/aws-sdk-go-v2/...)
Describe the bug
When using the retry package, the docs say that you can do this to set MaxAttempts:
customRetry := retry.NewStandard(func(o *retry.StandardOptions) {
o.MaxAttempts = 5
})My understanding is that setting MaxAttempts to 0 will result in unlimited attempts.
However, setting o.MaxAttempts = 0 is a no-op and retrying will still stop after the default of 3 attempts.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Setting o.MaxAttempts = 0 will result in unlimted retries
Current Behavior
Retrying still stops after the default of 3 attempts
Reproduction Steps
package main
import (
"context"
"log"
"time"
"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"
)
func main() {
retryer := retry.NewStandard(func(o *retry.StandardOptions) {
o.MaxAttempts = 0
})
cfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithRetryer(func() aws.Retryer {
return retryer
}),
)
}Possible Solution
No response
Additional Information/Context
Setting MaxAttempts like this worked to get unlimited retries:
cfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithRetryer(func() aws.Retryer {
return retry.AddWithMaxAttempts(retryer, 0)
}),
)AWS Go SDK V2 Module Versions Used
module foo
go 1.25.1
require (
github.com/aws/aws-sdk-go-v2 v1.39.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.31.8 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.18.12 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ec2 v1.253.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.29.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.38.4 // indirect
github.com/aws/smithy-go v1.23.0 // indirect
)
Compiler and Version used
go version go1.25.1 linux/amd64
Operating System and version
Ubuntu 24.04.3 LTS
Metadata
Metadata
Assignees
Labels
documentationThis is a problem with documentation.This is a problem with documentation.queuedThis issues is on the AWS team's backlogThis issues is on the AWS team's backlog