Oxidaner commented on code in PR #3235:
URL: https://github.com/apache/dubbo-go/pull/3235#discussion_r2969108953


##########
protocol/grpc/grpc_protocol.go:
##########
@@ -38,10 +41,36 @@ const (
 
 func init() {
        extension.SetProtocol(GRPC, GetProtocol)
+
+       // register graceful shutdown callback
+       extension.RegisterGracefulShutdownCallback(GRPC, func(ctx 
context.Context) error {
+               grpcProto := GetProtocol()
+               if grpcProto == nil {
+                       return nil
+               }
+
+               gp, ok := grpcProto.(*GrpcProtocol)
+               if !ok {
+                       return nil
+               }
+
+               gp.serverLock.Lock()
+               defer gp.serverLock.Unlock()
+
+               for _, server := range gp.serverMap {
+                       server.SetAllServicesNotServing()
+               }
+
+               return nil
+       })
 }
 
 var grpcProtocol *GrpcProtocol
 
+var grpcServerGracefulStop = func(server *Server) {
+       server.GracefulStop()
+}
+
 // GrpcProtocol is gRPC protocol

Review Comment:
   yes, Some are in the grpc_protocol_test.go 



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