XnLemon commented on code in PR #3369:
URL: https://github.com/apache/dubbo-go/pull/3369#discussion_r3369187884
##########
metadata/mapping/metadata/service_name_mapping.go:
##########
@@ -96,11 +97,23 @@ func (d *ServiceNameMapping) Get(url *common.URL, listener
mapping.MappingListen
return metadataReport.GetServiceAppMapping(serviceInterface,
DefaultGroup, listener)
}
+// Remove removes the service-to-app mapping for the given URL from all
+// registered metadata reports. Unlike Map (which stops on the first failure),
+// Remove is best-effort: it attempts every report and returns all errors
+// joined together so the caller can see the full failure picture. The
+// intent is to avoid leaving stale entries in any registry due to a transient
+// error in one of the others.
func (d *ServiceNameMapping) Remove(url *common.URL) error {
serviceInterface := url.GetParam(constant.InterfaceKey, "")
- metadataReport := metadata.GetMetadataReport()
- if metadataReport == nil {
+ metadataReports := metadata.GetMetadataReports()
+ if len(metadataReports) == 0 {
Review Comment:
GetMetadataReports() 这个方法返回的是一个切片 里面有`make([]report.MetadataReport,
len(instances))` 所以不返回nil 顶多可能抛个空切片而已
之前的GetMetadataReport()全局 instances map 是空的话就会返回nil 所以一开始才兜了 给它加上也行
--
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]