Copilot commented on code in PR #3034:
URL: https://github.com/apache/dubbo-go/pull/3034#discussion_r2365561283


##########
protocol/grpc/client.go:
##########
@@ -139,8 +139,12 @@ func NewClient(url *common.URL) (*Client, error) {
        }
 
        key := url.GetParam(constant.InterfaceKey, "")
-       impl := config.GetConsumerServiceByInterfaceName(key)
-       invoker := getInvoker(impl, conn)
+       //TODO: Temporary compatibility with old APIs, can be removed later
+       consumerService := config.GetConsumerServiceByInterfaceName(key)
+       if rpcService, ok := url.GetAttribute(constant.RpcServiceKey); ok {
+               consumerService = rpcService
+       }

Review Comment:
   This is identical logic to the triple protocol implementation. Consider 
extracting this consumer service resolution logic into a shared utility 
function to avoid code duplication.



##########
protocol/triple/dubbo3_invoker.go:
##########
@@ -80,7 +80,11 @@ func NewDubbo3Invoker(url *common.URL) (*DubboInvoker, 
error) {
        // for triple pb serialization. The bean name from provider is the 
provider reference key,
        // which can't locate the target consumer stub, so we use interface 
key..
        interfaceKey := url.GetParam(constant.InterfaceKey, "")
+       //TODO: Temporary compatibility with old APIs, can be removed later
        consumerService := 
config.GetConsumerServiceByInterfaceName(interfaceKey)
+       if rpcService, ok := url.GetAttribute(constant.RpcServiceKey); ok {
+               consumerService = rpcService
+       }

Review Comment:
   [nitpick] The TODO comment indicates this is temporary code for backward 
compatibility. Consider adding a timeline or version number for when this can 
be removed, and ensure there's a plan to migrate away from the old API.



-- 
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-unsubscr...@dubbo.apache.org

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


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

Reply via email to