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

[Config] Acknowledge when Advanced Settings respond #16485

Merged

Conversation

pickypg
Copy link
Member

@pickypg pickypg commented Feb 2, 2018

This adds a return value to the Promise returned by config.set, which allows callers to await it and verify that their setting was applied without checking the settings (which is a race condition).

A future update might be good to change the notifier usage to a toastNotification, but that is a wider effort.

@pickypg pickypg added release_note:enhancement review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.0.0 v6.3.0 labels Feb 2, 2018
@pickypg pickypg changed the title [Config] Acknowledge when Advanced Settings response [Config] Acknowledge when Advanced Settings respond Feb 2, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

had a small question

})
.catch(reason => {
localUpdate(key, initialVal, config.get(key));
notify.error(reason);
return false;
Copy link
Member

Choose a reason for hiding this comment

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

is there a way to have this return value covered in a test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not without exposing the change method and allowing the delayedUpdate method to be overridden, or adding the override to change and set, which is undesirable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided it was worth the effort, so I exposed change as _change and added tests for true and false scenarios.

This adds a return value to the `Promise` returned by `config.set`, which
allows callers to `await` it  and verify that their setting was applied
without checking the settings (which is a race condition).
@pickypg pickypg force-pushed the feature/config-should-acknowledge-set branch from 1c0b7b7 to 78c2a8d Compare February 2, 2018 20:41
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@spalger
Copy link
Contributor

spalger commented Feb 3, 2018

I think it might be time to rip out the delayed updater, cc @nreese

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding the rejection test

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM

@pickypg pickypg merged commit c0a1343 into elastic:master Feb 5, 2018
@pickypg pickypg deleted the feature/config-should-acknowledge-set branch February 5, 2018 19:39
pickypg added a commit that referenced this pull request Feb 5, 2018
This adds a return value to the `Promise` returned by `config.set`, which allows callers to `await` it  and verify that their setting was applied without checking the settings (which is a race condition).
@pickypg
Copy link
Member Author

pickypg commented Feb 5, 2018

6.x/6.3: 1b4fab3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v6.3.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants