Just return empty instance list if service not found #1367
This commit is contained in:
parent
0f72a349c5
commit
581e732305
@ -100,7 +100,7 @@ public class HostReactor {
|
||||
public ServiceInfo processServiceJSON(String json) {
|
||||
ServiceInfo serviceInfo = JSON.parseObject(json, ServiceInfo.class);
|
||||
ServiceInfo oldService = serviceInfoMap.get(serviceInfo.getKey());
|
||||
if (serviceInfo.getHosts() == null || !serviceInfo.validate()) {
|
||||
if (serviceInfo.getHosts() == null || serviceInfo.getHosts().isEmpty() || !serviceInfo.validate()) {
|
||||
//empty or error push, just ignore
|
||||
return oldService;
|
||||
}
|
||||
|
@ -373,7 +373,11 @@ public class InstanceController {
|
||||
Service service = serviceManager.getService(namespaceId, serviceName);
|
||||
|
||||
if (service == null) {
|
||||
throw new NacosException(NacosException.NOT_FOUND, "service not found: " + serviceName);
|
||||
if (Loggers.DEBUG_LOG.isDebugEnabled()) {
|
||||
Loggers.DEBUG_LOG.debug("no instance to serve for service: " + serviceName);
|
||||
}
|
||||
result.put("hosts", new JSONArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
checkIfDisabled(service);
|
||||
|
Loading…
Reference in New Issue
Block a user