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

avoid dup refresh for registry config #3135

Merged
merged 4 commits into from
Jan 6, 2019
Merged

avoid dup refresh for registry config #3135

merged 4 commits into from
Jan 6, 2019

Conversation

beiwei30
Copy link
Member

@beiwei30 beiwei30 commented Jan 4, 2019

What is the purpose of the change

XXXXX

Brief changelog

XXXXX

Verifying this change

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@@ -478,7 +477,7 @@ private void convertRegistryIdsToRegistries() {
}
Arrays.stream(arr).forEach(id -> {
if (registries.stream().noneMatch(reg -> reg.getId().equals(id))) {
RegistryConfig registryConfig = new RegistryConfig();
RegistryConfig registryConfig = new RegistryConfig(RegistryConfig.NO_AVAILABLE);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we can give RegistryConfig a default value RegistryConfig.NO_AVAILABLE, instead we should leave it empty. We will try to refresh this RegistryConfig later, if the user fails to set the right item for RegistryConfig, it will receive an Exception then when checking isValid. But if we give it this default value, it will always pass isValid and does register URL to Registry Center which can be unexpected behaviour.

@@ -118,6 +118,8 @@ public void checkApplication2() throws Exception {
public void testLoadRegistries() throws Exception {
System.setProperty("dubbo.registry.address", "addr1");
InterfaceConfig interfaceConfig = new InterfaceConfig();
// FIXME: now we need to check first, then load
interfaceConfig.checkRegistry();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should give loadRegistries another name that can better reflect what it does. It is misleading since it loads nothing except for converts RegistryConfigs to URLs.

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