AlexStocks commented on code in PR #3442:
URL: https://github.com/apache/dubbo-go/pull/3442#discussion_r3435482937
##########
registry/servicediscovery/service_discovery_registry.go:
##########
@@ -362,6 +364,7 @@ func (s *serviceDiscoveryRegistry) SubscribeURL(url
*common.URL, notify registry
protocol = url.Protocol
}
protocolServiceKey := url.ServiceKey() + ":" + protocol
+ s.lock.Lock()
Review Comment:
unlock都跑到line 385 了,这太远了,一旦出现 panic 就死锁了,要善于使用 defer + lambda 表达式
啊,童子。我教你个技巧:
func() {
m.lock()
defer m.unlock()
xxx
}()
--
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]