-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sqs client retryer #1099
Add sqs client retryer #1099
Conversation
@@ -223,7 +222,7 @@ func main() { | |||
QueueURL: nthConfig.QueueURL, | |||
InterruptionChan: interruptionChan, | |||
CancelChan: cancelChan, | |||
SQS: sqs.New(sess), | |||
SQS: sqsevent.GetSqsClient(sess), | |||
ASG: autoscaling.New(sess), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also add retry for asg client?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could keep use default retryer for asg client.
DefaultRetryer: client.DefaultRetryer{ | ||
NumMaxRetries: client.DefaultRetryerMaxNumRetries, | ||
MinRetryDelay: client.DefaultRetryerMinRetryDelay, | ||
MaxRetryDelay: 1200 * time.Millisecond, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any particular reason why we don't set MaxRetryDelay to be DefaultRetryerMaxRetryDelay and same for DefaultRetryerMinThrottleDelay? https://github.com/aws/aws-sdk-go/blob/7112c0a0c2d01713a9db2d57f0e5722225baf5b5/aws/client/default_retryer.go#L49C2-L49C29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by adding doc comment.
client.DefaultRetryer | ||
} | ||
|
||
func (r SqsRetryer) ShouldRetry(req *request.Request) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: personally I would prefer more descriptive variable names (perhaps retryer instead or r), just so I don't have to search for the type.
temp bool | ||
} | ||
|
||
func TestGetSqsClient(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test case seems unnecessary because it's testing an implementation detail rather than behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would keep test case to test custom retryer config is consumed or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Issue #, if available:
#717
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.