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


##########
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
   
   I fix it



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

Reply via email to