mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
Update parameter of API startGrpc (#13282)
Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
This commit is contained in:
parent
a76ea1bfc4
commit
973b98c721
@ -158,7 +158,7 @@ func (s *Server) init() error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = s.startGrpc()
|
||||
err = s.startGrpc(Params.Port)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -209,15 +209,15 @@ func (s *Server) init() error {
|
||||
return s.rootCoord.Init()
|
||||
}
|
||||
|
||||
func (s *Server) startGrpc() error {
|
||||
func (s *Server) startGrpc(port int) error {
|
||||
s.wg.Add(1)
|
||||
go s.startGrpcLoop(Params.Port)
|
||||
go s.startGrpcLoop(port)
|
||||
// wait for grpc server loop start
|
||||
err := <-s.grpcErrChan
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *Server) startGrpcLoop(grpcPort int) {
|
||||
func (s *Server) startGrpcLoop(port int) {
|
||||
defer s.wg.Done()
|
||||
var kaep = keepalive.EnforcementPolicy{
|
||||
MinTime: 5 * time.Second, // If a client pings more than once every 5 seconds, terminate the connection
|
||||
@ -228,8 +228,8 @@ func (s *Server) startGrpcLoop(grpcPort int) {
|
||||
Time: 60 * time.Second, // Ping the client if it is idle for 60 seconds to ensure the connection is still active
|
||||
Timeout: 10 * time.Second, // Wait 10 second for the ping ack before assuming the connection is dead
|
||||
}
|
||||
log.Debug("start grpc ", zap.Int("port", grpcPort))
|
||||
lis, err := net.Listen("tcp", ":"+strconv.Itoa(grpcPort))
|
||||
log.Debug("start grpc ", zap.Int("port", port))
|
||||
lis, err := net.Listen("tcp", ":"+strconv.Itoa(port))
|
||||
if err != nil {
|
||||
log.Error("GrpcServer:failed to listen", zap.String("error", err.Error()))
|
||||
s.grpcErrChan <- err
|
||||
|
@ -103,7 +103,7 @@ func TestGrpcService(t *testing.T) {
|
||||
err = core.Register()
|
||||
assert.Nil(t, err)
|
||||
|
||||
err = svr.startGrpc()
|
||||
err = svr.startGrpc(Params.Port)
|
||||
assert.Nil(t, err)
|
||||
svr.rootCoord.UpdateStateCode(internalpb.StateCode_Initializing)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user