AlexStocks commented on code in PR #3270:
URL: https://github.com/apache/dubbo-go/pull/3270#discussion_r3031284102
##########
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:
[P0] 这里把订阅启动放到了 `Register` 成功之后,改变了原有容错语义。`registry/protocol/protocol.go` 里
`dic.Subscribe(...)` 返回错误时只记日志,后面仍会继续 `cluster.Join(dic)` 并返回
invoker;也就是说一旦注册超时或失败,消费者已经被创建出来,但永远不会启动订阅协程,目录会一直拿不到 provider
列表。建议保持订阅与注册解耦,先启动 `registry.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]