-
Notifications
You must be signed in to change notification settings - Fork 820
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
Conversation
@@ -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'; |
There was a problem hiding this comment.
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
@@ -78,7 +86,7 @@ class EnvironmentParameterManager implements IEnvironmentParameterManager { | |||
return !!this.resourceParamManagers[getResourceKey(category, resource)]; | |||
} | |||
|
|||
save(): void { | |||
async save(): Promise<void> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
packages/amplify-environment-parameters/src/environment-parameter-manager.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Kamil Sobol <[email protected]>
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
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.