Skip to content

Conversation

@otaviomacedo
Copy link
Contributor

@otaviomacedo otaviomacedo commented Nov 5, 2025

The CLI is making an unlimited number of concurrent GetTemplate requests. When there is a large number of stacks, CloudFormation may throttle the requests.

Limit concurrency to 20.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.95%. Comparing base (d1b4113) to head (96ddb11).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #927      +/-   ##
==========================================
+ Coverage   83.45%   83.95%   +0.49%     
==========================================
  Files          71       71              
  Lines       10401    10401              
  Branches     1317     1324       +7     
==========================================
+ Hits         8680     8732      +52     
+ Misses       1680     1628      -52     
  Partials       41       41              
Flag Coverage Δ
suite.unit 83.95% <ø> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

};
};

const limit = pLimit(20);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still seems like a high number?

Are the retry settings configured thoroughly enough for the CFN client?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current retry strategy for the CFN client:

new ConfiguredRetryStrategy(11, (attempt: number) => 1000 * (2 ** attempt))

I ran an experiment with this strategy, against an account with 342 templates. I didn't start getting throttling errors until concurrency = 47. So, 20 might be playing it too safely, actually.

Just as a sanity check, without any retry strategy, even with concurrency = 2, I would sometimes get a throttling error.

Copy link
Contributor

@rix0rrr rix0rrr Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, thanks!

@otaviomacedo otaviomacedo requested a review from rix0rrr November 5, 2025 13:43
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Nov 5, 2025
Merged via the queue into main with commit c79e35e Nov 5, 2025
40 checks passed
@aws-cdk-automation aws-cdk-automation deleted the otaviom/limit-get-template-concurrency branch November 5, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants