Skip to content
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

删除空服务时,发布DeregisterServiceTraceEvent 传参错误 #11951

Closed
Happy-26 opened this issue Apr 11, 2024 · 1 comment · Fixed by #11955
Closed

删除空服务时,发布DeregisterServiceTraceEvent 传参错误 #11951

Happy-26 opened this issue Apr 11, 2024 · 1 comment · Fixed by #11955
Labels
kind/bug Category issues or prs related to bug.

Comments

@Happy-26
Copy link
Contributor

Happy-26 commented Apr 11, 2024

ServiceNameFilter#doFilter()方法中,使用groupName@@serviceName作为一个新的服务名,在ServiceController#remove()方法中,发布DeregisterServiceTraceEvent事件时,未对组装后的serviceName进行处理,源代码如下:

@DeleteMapping
@TpsControl(pointName = "NamingServiceDeregister", name = "HttpNamingServiceDeregister")
@Secured(action = ActionTypes.WRITE)
public String remove(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
        @RequestParam String serviceName) throws Exception {
    getServiceOperator().delete(namespaceId, serviceName);
    NotifyCenter.publishEvent(
            new DeregisterServiceTraceEvent(System.currentTimeMillis(), namespaceId, "", serviceName));
    return "ok";
}

修改后的代码如下:

@DeleteMapping
@TpsControl(pointName = "NamingServiceDeregister", name = "HttpNamingServiceDeregister")
@Secured(action = ActionTypes.WRITE)
public String remove(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
        @RequestParam String serviceName) throws Exception {
    
    getServiceOperator().delete(namespaceId, serviceName);
    NotifyCenter.publishEvent(
            new DeregisterServiceTraceEvent(System.currentTimeMillis(), namespaceId,
                    NamingUtils.getGroupName(serviceName), NamingUtils.getServiceName(serviceName)));
    return "ok";
}
@KomachiSion
Copy link
Collaborator

有工具类:NamingUtils 来获取groupName和serviceName

@KomachiSion KomachiSion added the kind/bug Category issues or prs related to bug. label Apr 11, 2024
KomachiSion pushed a commit that referenced this issue Apr 15, 2024
… not resolved correctly when deleting an empty service instance (#11955)

* Fixed an issue where the maximum number of anti-fragile plug-ins implemented by default in Nacos is one more than the actual number of connections.

* bug fix : 修改删除空服务实例时,服务名和分组名没有正确解析的问题
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Category issues or prs related to bug.
Projects
None yet
2 participants