You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/08/19 02:33:38 UTC

[GitHub] [dubbo-go] chuntaojun commented on a diff in pull request #2021: fix polaris Subscription parameters are invalid

chuntaojun commented on code in PR #2021:
URL: https://github.com/apache/dubbo-go/pull/2021#discussion_r949746640


##########
registry/polaris/registry.go:
##########
@@ -163,15 +168,24 @@ func (pr *polarisRegistry) Subscribe(url *common.URL, notifyListener registry.No
 			continue
 		}
 
+		watcher, err := newPolarisWatcher(&newParam, newConsumer)
+		if err != nil {
+			logger.Warnf("getwatcher() = err:%v", perrors.WithStack(err))
+			<-time.After(time.Duration(RegistryConnDelay) * time.Second)

Review Comment:
   这里建议使用 NewTimer + Reset 的方式对 timer 进行复用,避免 time.After 的泄漏问题



##########
registry/polaris/registry.go:
##########
@@ -163,15 +168,24 @@ func (pr *polarisRegistry) Subscribe(url *common.URL, notifyListener registry.No
 			continue
 		}
 
+		watcher, err := newPolarisWatcher(&newParam, newConsumer)

Review Comment:
   watcher 如果面对的是一个重复的 newParam 的话,会重复创建吧?需要对 watcher 做一个 map 存储减少 newPolarisWatcher 的动作



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org