AlexStocks commented on code in PR #3479:
URL: https://github.com/apache/dubbo-go/pull/3479#discussion_r3536296565
##########
registry/nacos/registry.go:
##########
@@ -366,6 +376,7 @@ func (nr *nacosRegistry) LoadSubscribeInstances(url
*common.URL, notify registry
return perrors.New(fmt.Sprintf("could not query the instances
for serviceName=%s,groupName=%s,error=%v",
serviceName, groupName, err))
}
+ nr.storeInitialSubscribeInstances(serviceName, groupName, instances)
Review Comment:
[P1] 缺少初始快照去重的回归测试
这次修复依赖 `LoadSubscribeInstances` 先保存 `SelectAllInstances` 的快照,再由后续
`subscribe` 把快照灌进 listener,避免 Nacos 首次回调把已经通过 `LoadSubscribeInstances` 通知过的
provider 再发一次 ADD,同时还要保证快照里有、首次回调里没有的 provider 会发 DEL。当前 PR 没有新增测试覆盖
`LoadSubscribeInstances -> subscribe -> Callback` 这条链路,现有 `go test
./registry/nacos/...` 只能证明现有用例未坏,不能防止这个 bug 回归。需要补一个 registry/nacos 层的回归测试:先用
mock `SelectAllInstances` 返回 A/B 并断言 notify 收到初始 ADD,再订阅并触发 callback 只返回
A,断言不会重复 ADD A,且会对 B 发 DEL。
--
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]