-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
avoid dup refresh for registry config #3135
Conversation
…tRegistryIdsToRegistries generates invalid registry config
@@ -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); |
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.
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(); |
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.
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.
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:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests=false
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.