Skip to content

Commit df705ae

Browse files
committed
fix(cloudcontrol): set to 55 req/min
1 parent 136ba3d commit df705ae

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

resources/cloudcontrol.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ func init() {
5656
}
5757

5858
// describeRateLimit is a rate limiter to avoid throttling when describing resources via the cloud control api.
59-
// AWS does not publish the rate limits for the cloud control api. Testing shows it fails around 30-35 requests per
60-
// second, therefore we set the rate limit to 25 requests per second to try and stay under the limit at all times.
61-
var describeRateLimit = ratelimit.New(25, ratelimit.Per(time.Second))
59+
// AWS does not publish the rate limits for the cloud control api, the rate seems to be 60 reqs/minute, setting to
60+
// 55 and setting no slack to avoid throttling.
61+
var describeRateLimit = ratelimit.New(55, ratelimit.Per(time.Minute), ratelimit.WithoutSlack)
6262

6363
// RegisterCloudControl registers a resource type for the Cloud Control API. This is a unique function that is used
6464
// in two different places. The first place is in the init() function of this file, where it is used to register
@@ -94,7 +94,8 @@ func (l *CloudControlResourceLister) List(_ context.Context, o interface{}) ([]r
9494
}
9595

9696
if err := svc.ListResourcesPages(params, func(page *cloudcontrolapi.ListResourcesOutput, lastPage bool) bool {
97-
describeRateLimit.Take()
97+
dt := describeRateLimit.Take()
98+
l.logger.Debugf("rate limit time: %s", dt)
9899

99100
for _, desc := range page.ResourceDescriptions {
100101
identifier := ptr.ToString(desc.Identifier)

0 commit comments

Comments
 (0)