Merge pull request #1919 from satjd/bugfix-#1916

[ISSUE #1916] Fix returning ErrCode:400 when register instances concurrently to non-existent services
This commit is contained in:
Fury Zhu 2019-10-15 19:57:52 +08:00 committed by GitHub
commit 45ca16f5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -445,9 +445,9 @@ public class ServiceManager implements RecordListener<Service> {
service.getClusterMap().put(cluster.getName(), cluster); service.getClusterMap().put(cluster.getName(), cluster);
} }
service.validate(); service.validate();
if (local) {
putServiceAndInit(service); putServiceAndInit(service);
} else { if (!local) {
addOrReplaceService(service); addOrReplaceService(service);
} }
} }
@ -470,9 +470,9 @@ public class ServiceManager implements RecordListener<Service> {
service.getClusterMap().put(cluster.getName(), cluster); service.getClusterMap().put(cluster.getName(), cluster);
} }
service.validate(); service.validate();
if (local) {
putServiceAndInit(service); putServiceAndInit(service);
} else { if (!local) {
addOrReplaceService(service); addOrReplaceService(service);
} }
} }