1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Description: service/ec2: Fix int overflow in minTime on 386 and arm
Author: Anthony Fok <foka@debian.org>
Origin: vendor
Bug: https://github.com/aws/aws-sdk-go/issues/2786
Last-Update: 2019-08-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
diff --git a/service/ec2/customizations.go b/service/ec2/customizations.go
index 7b42719d..7c9fccd7 100644
--- a/service/ec2/customizations.go
+++ b/service/ec2/customizations.go
@@ -38,8 +38,8 @@ func customRetryRule(r *request.Request) time.Duration {
count = len(retryTimes) - 1
}
- minTime := int(retryTimes[count])
- return time.Duration(sdkrand.SeededRand.Intn(minTime) + minTime)
+ minTime := int64(retryTimes[count])
+ return time.Duration(sdkrand.SeededRand.Int63n(minTime) + minTime)
}
func setCustomRetryer(c *client.Client) {
diff --git a/service/ec2/retryer_test.go b/service/ec2/retryer_test.go
index 5c955a0d..2900d6d5 100644
--- a/service/ec2/retryer_test.go
+++ b/service/ec2/retryer_test.go
@@ -27,7 +27,7 @@ func TestCustomRetryer(t *testing.T) {
req.RetryCount = 15
duration = svc.Client.Retryer.RetryRules(req)
if duration < time.Second*5 || duration > time.Second*10 {
- t.Errorf("expected duration to be between 1 and 2, but received %v", duration)
+ t.Errorf("expected duration to be between 5 and 10, but received %v", duration)
}
svc = New(unit.Session, &aws.Config{Region: aws.String("us-west-2"), Retryer: client.DefaultRetryer{}})
|