xxs588 commented on code in PR #3270:
URL: https://github.com/apache/dubbo-go/pull/3270#discussion_r3031438980
##########
registry/directory/directory.go:
##########
@@ -208,26 +203,58 @@ func (dir *RegistryDirectory) Subscribe(url *common.URL)
error {
timeout, _ = time.ParseDuration(constant.DefaultRegTimeout)
}
- done := make(chan struct{})
+ serviceKey := url.Key()
+ // Registration is bounded by registry timeout (default 5s).
+ // On timeout, we return immediately and skip starting subscribe
goroutine.
+ if err := dir.registerConsumerWithTimeout(url, timeout, serviceKey);
err != nil {
Review Comment:
这次改为先启动 registry.Subscribe,再执行带超时的 Register,保持订阅与注册解耦。
同时在 -race 验证中发现了测试侧存在新竞态(测试直接读 cacheInvokers、以及 normalRegistryDir 异步启动
Subscribe 带来的并发噪音),已同步修成并发安全读取和同步初始化。
--
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]