mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 19:39:21 +08:00
Fix proxy ut may hang with dn graceful stop (#8124)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
b84f017dde
commit
a972fafb5f
@ -141,7 +141,21 @@ func (s *Server) Stop() error {
|
||||
}
|
||||
s.cancel()
|
||||
if s.grpcServer != nil {
|
||||
s.grpcServer.GracefulStop()
|
||||
// make graceful stop has a timeout
|
||||
stopped := make(chan struct{})
|
||||
go func() {
|
||||
s.grpcServer.GracefulStop()
|
||||
close(stopped)
|
||||
}()
|
||||
|
||||
t := time.NewTimer(10 * time.Second)
|
||||
select {
|
||||
case <-t.C:
|
||||
// hard stop since grace timeout
|
||||
s.grpcServer.Stop()
|
||||
case <-stopped:
|
||||
t.Stop()
|
||||
}
|
||||
}
|
||||
|
||||
err := s.datanode.Stop()
|
||||
|
Loading…
Reference in New Issue
Block a user