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: async persist env params on success #11367

Merged
merged 4 commits into from
Nov 15, 2022

Conversation

edwardfoyle
Copy link
Contributor

Description of changes

Removes the save on exit listener from environment parameter managers and instead exposes a saveAll method that is called at the end of the CLI command execution to persist any mutated parameters.

This ensures that parameters are only persisted if the command succeeded and also allows us to perform async operations during the save.

Issue #, if available

Description of how you validated changes

manually verified and updated unit tests

Checklist

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

@edwardfoyle edwardfoyle requested a review from a team as a code owner November 10, 2022 00:14
@@ -36,7 +36,7 @@ describe('amplify status:', () => {
const { run } = require('../../commands/status');
const runStatusCmd = run;
const statusPluginInfo = `${process.cwd()}/../amplify-console-hosting`;
const mockPath = './';
const mockPath = './help';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not 100% sure why the test updates in this file were necessary

jhockett
jhockett previously approved these changes Nov 10, 2022
@@ -78,7 +86,7 @@ class EnvironmentParameterManager implements IEnvironmentParameterManager {
return !!this.resourceParamManagers[getResourceKey(category, resource)];
}

save(): void {
async save(): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

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

no await inside the body?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it can be synchronous for now, but we are getting ready to add some async stuff

Co-authored-by: Kamil Sobol <[email protected]>
@edwardfoyle edwardfoyle merged commit 0433431 into aws-amplify:dev Nov 15, 2022
@edwardfoyle edwardfoyle deleted the async-on-exit branch November 15, 2022 00:57
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.

3 participants