Skip to content
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

fix: filter non-sandbox stacks #736

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Conversation

johnpc
Copy link
Contributor

@johnpc johnpc commented Nov 22, 2023

Issue #, if available:
N/A

Description of changes:
There is currently an issue in deployed-backend-client where calling getOutput for every stack to determine deploymentType: 'sandbox' is causing high latency and throttling exceptions from listSandboxes.

This PR adds a heuristic to filter stacks that are not named using the sandbox naming convention in order to prevent excessive getOutput calls.

I've also refactored the test suite a bit since it was getting unruly.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

changeset-bot bot commented Nov 22, 2023

🦋 Changeset detected

Latest commit: 0a198ee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/deployed-backend-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 75 to 81
.map(async (stackSummary: StackSummary) => {
const deploymentType = await this.tryGetDeploymentType(stackSummary);

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we now even need this call? Isn't it guaranteed that whatever got filtered is Sandbox deploymentType by definition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the idea is that it's possible for a stack to be named in way that matches the heuristic, but isn't truly a sandbox. The stack metadata is the best way to get the deploymentType.

sdstolworthy
sdstolworthy previously approved these changes Nov 22, 2023
Amplifiyer
Amplifiyer previously approved these changes Nov 22, 2023
Copy link
Contributor

@Amplifiyer Amplifiyer left a comment

Choose a reason for hiding this comment

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

non blocker nits

import { ArnGenerator } from './deployed-backend-client/arn_generator.js';
import { ArnParser } from './deployed-backend-client/arn_parser.js';

const listStacksMock = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const listStacksMock = {
const listStacksMockResponse = {

];

beforeEach(() => {
getOutputMock.mock.mockImplementation(
Copy link
Contributor

Choose a reason for hiding this comment

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

These need not be in beforeEach I'm guessing, can be moved out to the describe

edwardfoyle
edwardfoyle previously approved these changes Nov 22, 2023
Copy link
Contributor

@edwardfoyle edwardfoyle left a comment

Choose a reason for hiding this comment

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

One comment but it can be a fast follow if we need to get this merged. But it should be pretty easy to incorporate. If this PR goes in without it, please either make the follow up PR, or cut a tech-debt issue to track.

Copy link
Member

@sobolk sobolk left a 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 some retries when we configure SDK client ? That seems to be dealing with throttling in cleanup script.

@sdstolworthy
Copy link
Contributor

Should we also add some retries when we configure SDK client ? That seems to be dealing with throttling in cleanup script.

@sobolk We can make a change on the console side to incorporate more retries.

@edwardfoyle edwardfoyle merged commit d2c3baa into main Nov 30, 2023
20 checks passed
@edwardfoyle edwardfoyle deleted the xss/filter-non-sandbox-stacks branch November 30, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants