浏览代码

chore: update restful/grpc servers shutdown stages (#3662)

Kevin Wan 1 年之前
父节点
当前提交
c2ff00883a
共有 3 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      rest/internal/starter.go
  2. 1 1
      zrpc/internal/rpcserver.go
  3. 1 1
      zrpc/internal/rpcserver_test.go

+ 1 - 1
rest/internal/starter.go

@@ -43,7 +43,7 @@ func start(host string, port int, handler http.Handler, run func(svr *http.Serve
 	}
 	healthManager := health.NewHealthManager(fmt.Sprintf("%s-%s:%d", probeNamePrefix, host, port))
 
-	waitForCalled := proc.AddWrapUpListener(func() {
+	waitForCalled := proc.AddShutdownListener(func() {
 		healthManager.MarkNotReady()
 		if e := server.Shutdown(context.Background()); e != nil {
 			logx.Error(e)

+ 1 - 1
zrpc/internal/rpcserver.go

@@ -76,7 +76,7 @@ func (s *rpcServer) Start(register RegisterFn) error {
 
 	// we need to make sure all others are wrapped up,
 	// so we do graceful stop at shutdown phase instead of wrap up phase
-	waitForCalled := proc.AddWrapUpListener(func() {
+	waitForCalled := proc.AddShutdownListener(func() {
 		if s.health != nil {
 			s.health.Shutdown()
 		}

+ 1 - 1
zrpc/internal/rpcserver_test.go

@@ -47,7 +47,7 @@ func TestRpcServer(t *testing.T) {
 	grpcServer.GracefulStop()
 	lock.Unlock()
 
-	proc.WrapUp()
+	proc.Shutdown()
 	wgDone.Wait()
 }