dubbo-admin icon indicating copy to clipboard operation
dubbo-admin copied to clipboard

使用Nacos作为dubbo注册中心时,服务列表不全

Open muxue-wang opened this issue 1 year ago • 2 comments

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.
  • [ ] I have checked the REAMDE of this repository and believe that this is not a duplicate.

Environment

  • Dubbo Admin version: 3.0.6
  • Registry center detail (type and version): Nacos 2.0.3
  • Operating System version: windows
  • Java version: java 8

Steps to reproduce this issue

后台显示服务列表不全 image

问题出现在这个方法,这个返回值count错误,导致不会继续拉取下一页,入参PAGINATION_SIZE是多少,返回值count就是多少 org.apache.dubbo.admin.registry.mapping.impl.NacosServiceMapping#getAllServiceNames org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper#getServicesOfServer image

image

muxue-wang avatar Sep 11 '24 08:09 muxue-wang

Dubbo Admin version:0.6.0

muxue-wang avatar Sep 11 '24 08:09 muxue-wang

这个分页错误,可以改成这样

    private Set<String> getAllServiceNames() throws NacosException {
        Set<String> serviceNames = new HashSet<>();
        int pageIndex = 1;
        ListView<String> listView;

        do {
            listView = namingService.getServicesOfServer(pageIndex++, PAGINATION_SIZE, Constants.DEFAULT_GROUP);
            serviceNames.addAll(listView.getData());
        } while (listView.getData().size() == PAGINATION_SIZE && !listView.getData().isEmpty());

        return serviceNames;
    }

muxue-wang avatar Sep 11 '24 09:09 muxue-wang