conghuhu commented on code in PR #10543:
URL: https://github.com/apache/dubbo/pull/10543#discussion_r967640680
##########
dubbo-kubernetes/src/main/java/org/apache/dubbo/registry/kubernetes/KubernetesServiceDiscovery.java:
##########
@@ -168,23 +167,23 @@ public void doUnregister(ServiceInstance serviceInstance)
throws RuntimeExceptio
@Override
public Set<String> getServices() {
return kubernetesClient
- .services()
- .inNamespace(namespace)
- .list()
- .getItems()
- .stream()
- .map(service -> service.getMetadata().getName())
- .collect(Collectors.toSet());
+ .services()
+ .inNamespace(namespace)
+ .list()
+ .getItems()
+ .stream()
+ .map(service -> service.getMetadata().getName())
+ .collect(Collectors.toSet());
}
@Override
public List<ServiceInstance> getInstances(String serviceName) throws
NullPointerException {
Endpoints endpoints =
- kubernetesClient
- .endpoints()
- .inNamespace(namespace)
- .withName(serviceName)
- .get();
+ kubernetesClient
+ .endpoints()
+ .inNamespace(namespace)
+ .withName(serviceName)
+ .get();
Review Comment:
I added SERVICE_INSTANCE MAP, which caches the change endpoints from
informer notifications.
In this way, it can reduce the number of times to get the endpoint list from
k8s at a time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]