CAICAIIs commented on code in PR #3178:
URL: https://github.com/apache/dubbo-go/pull/3178#discussion_r2724949074
##########
registry/nacos/registry.go:
##########
@@ -200,16 +202,23 @@ func (nr *nacosRegistry) Subscribe(url *common.URL,
notifyListener registry.Noti
}
func (nr *nacosRegistry) subscribeUntilSuccess(url *common.URL, notifyListener
registry.NotifyListener) {
- // retry forever
- for {
+ bo := backoff.NewExponentialBackOff()
+ bo.InitialInterval = 1 * time.Second
+ bo.MaxInterval = 30 * time.Second
+ bo.MaxElapsedTime = 0 // never timeout, retry forever
+
+ operation := func() error {
if !nr.IsAvailable() {
- return
- }
- err := nr.subscribe(getSubscribeName(url), notifyListener)
- if err == nil {
- return
+ return backoff.Permanent(perrors.New("registry
unavailable"))
}
Review Comment:
原来的代码也是 !nr.IsAvailable() 后直接直接退出,这里应该是意味着 registry 已经被显示关闭了,应该是不需要重试
--
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]