Respect retryer set in ECS Waiters #1655
-
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug Version of AWS SDK for Go? Version of Go ( To Reproduce (observed behavior) ecsManager := ecs.NewFromConfig(ktm.AWSConf, func(options *ecs.Options) {
options.Retryer = retry.AddWithMaxAttempts(retry.NewStandard(), 1)
})
startWaiter := ecs.NewTasksRunningWaiter(ecsManager)
err := startWaiter.Wait(ctx, &ecs.DescribeTasksInput{
Cluster: &ktm.Cluster,
Tasks: []string{ktt.TaskARN},
}, time.Second, func(o *ecs.TasksRunningWaiterOptions) {
o.LogWaitAttempts = true
o.MinDelay = time.Nanosecond
o.MaxDelay = time.Nanosecond
}) Output:
Expected behavior |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thanks for reaching out @TopherGopher. From your example it looks like you're looking to limit the number of attempts the The API client's The v2 SDK changed how it determines how long to run for, making the number of wait attempts an internal aspect of the waiter. Part of the reasoning behind this was that waiters can have significantly different wait time between attempt defined by the service team. From the application's perspective, the duration the waiter is running is generally the most important. Whereas the number of attempts the waiter makes is an internal behavior. This is the reason the v2 SDK's waiters take a wait duration in the function signature. The wait duration limits how long the waiter will run. Similar to a Context with timeout, but as a value the SDK can use directly without channels/goroutines. If you're looking to ensure the waiter only makes a single attempt the TasksRunningWaiterOptions option struct has a member If you're looking to control the number of attempts the waiter makes to something other than 1, this is a bit more complicated. Because, currently the implementation of the waiter retryable function is not exported. This means you wouldn't be able to wrap the SDK's internal wait retryable logic with your own. We're open to reviewing if these functions should stay private or not. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for that help @jasdel - much appreciated! |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Thanks for reaching out @TopherGopher. From your example it looks like you're looking to limit the number of attempts the
TaskRunningWaiter
checks for the target state, before giving up. The configuration of waiters in v2 abstracted out number of attempts, in favor the maximum duration to wait for.The API client's
Retryer
operates on individual API operations calls. The waiter treats API operation calls as opaque across per wait attempt. This means that API operation retry attempt are evaluated separate from waiter wait attempts. The two's configuration do not overlap. An API operation can be retried the maximum number of retry attempts, and this will have no impact on the waiter's wait …