fix querynode's port not set correctly when conflict with other node (#5066)

Signed-off-by: xige-16 <xi.ge@zilliz.com>
This commit is contained in:
xige-16 2021-05-07 12:03:53 +08:00 committed by GitHub
parent 172f416e8f
commit 1e7205fa03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,7 +215,7 @@ func (s *Server) startGrpcLoop(grpcPort int) {
addr := ":" + strconv.Itoa(grpcPort) addr := ":" + strconv.Itoa(grpcPort)
lis, err = net.Listen("tcp", addr) lis, err = net.Listen("tcp", addr)
if err == nil { if err == nil {
Params.QueryNodePort = lis.Addr().(*net.TCPAddr).Port qn.Params.QueryNodePort = int64(lis.Addr().(*net.TCPAddr).Port)
} else { } else {
// set port=0 to get next available port // set port=0 to get next available port
grpcPort = 0 grpcPort = 0