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 2020/05/16 04:35:18 UTC

[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #510: [WIP] Ftr : add UnRegister and UnSubscribe for zookeeper Registry

AlexStocks commented on a change in pull request #510:
URL: https://github.com/apache/dubbo-go/pull/510#discussion_r426117380



##########
File path: registry/base_registry.go
##########
@@ -165,20 +165,29 @@ func (r *BaseRegistry) UnRegister(conf common.URL) error {
 		err    error
 		oldURL common.URL
 	)
-	r.cltLock.Lock()
-	oldURL, ok = r.services[conf.Key()]
-	delete(r.services, conf.Key())
-	r.cltLock.Unlock()
+	func() {
+		r.cltLock.RLock()
+		defer r.cltLock.RUnlock()
+		oldURL, ok = r.services[conf.Key()]
+	}()
+
+	func() {

Review comment:
       look, guy, Number 1, I do not agree with ur modification of the above four lines code block. Number 2, u should not use read lock for a write action(delete). Number 3, u should use RUnlock for RLock.

##########
File path: remoting/zookeeper/listener.go
##########
@@ -316,5 +316,6 @@ func (l *ZkEventListener) valid() bool {
 
 // Close ...

Review comment:
       pls add comment for this func. thx.




----------------------------------------------------------------
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.

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