Alanxtl commented on code in PR #3034:
URL: https://github.com/apache/dubbo-go/pull/3034#discussion_r2444993506
##########
protocol/dubbo3/internal/client.go:
##########
@@ -21,6 +21,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/config"
)
+// TODO: After the config is removed, remove the test
func init() {
// for pb client
Review Comment:
pls add corresponding test in new api
##########
protocol/dubbo3/internal/server.go:
##########
Review Comment:
pls add corresponding test in new api
##########
protocol/grpc/server.go:
##########
@@ -199,14 +224,16 @@ func waitGrpcExporter(providerServices
map[string]*config.ServiceConfig) {
}
// registerService SetProxyImpl invoker and grpc service
-func registerService(providerServices map[string]*config.ServiceConfig, server
*grpc.Server) {
+// TODO #2741 old config compatibility
+func registerService(providerServices map[string]*global.ServiceConfig, server
*grpc.Server) {
for key, providerService := range providerServices {
+
+ //TODO: Temporary compatibility with old APIs, can be removed
later
service := config.GetProviderService(key)
Review Comment:
这行对config的依赖似乎并没有解除
##########
protocol/grpc/server.go:
##########
@@ -150,22 +151,37 @@ func (s *Server) Start(url *common.URL) {
s.grpcServer = server
go func() {
- providerServices := config.GetProviderConfig().Services
-
- if len(providerServices) == 0 {
- panic("provider service map is null")
+ providerServices := s.getProviderServices(url)
+ if providerServices == nil {
+ logger.Error("no provider service found")
+ return
}
- // wait all exporter ready , then set proxy impl and grpc
registerService
+ // wait all exporter ready, then set proxy impl and grpc
registerService
waitGrpcExporter(providerServices)
registerService(providerServices, server)
reflection.Register(server)
-
- if err = server.Serve(lis); err != nil {
+ if err := server.Serve(lis); err != nil {
logger.Errorf("server serve failed with err: %v", err)
}
}()
}
+// getProviderServices retrieves provider services from config or URL
attributes
+func (s *Server) getProviderServices(url *common.URL)
map[string]*global.ServiceConfig {
Review Comment:
why this func has a `(s *Server)` receiver? `s` seems unuse
##########
protocol/grpc/client.go:
##########
@@ -166,28 +174,35 @@ func clientInit() {
}
}()
- if rootConfig.Application == nil {
- return
- }
Review Comment:
why the check for application is deleted
--
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]