From 802920dd32d438ddec39072ee1f60d61a0e27c8b Mon Sep 17 00:00:00 2001 From: "binbin.zhang" Date: Wed, 15 Mar 2023 19:03:53 +0800 Subject: [PATCH] update ConnectionEvent capacity (#588) --- clients/naming_client/service_info_updater.go | 2 +- common/remote/rpc/connection.go | 2 +- common/remote/rpc/grpc_client.go | 5 +++-- common/remote/rpc/server_request_handler.go | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/clients/naming_client/service_info_updater.go b/clients/naming_client/service_info_updater.go index f61183fa..585df50c 100644 --- a/clients/naming_client/service_info_updater.go +++ b/clients/naming_client/service_info_updater.go @@ -77,7 +77,7 @@ func (s *ServiceInfoUpdater) updateServiceNow(serviceName, groupName, clusters s result, err := s.namingProxy.QueryInstancesOfService(serviceName, groupName, clusters, 0, false) if err != nil { - logger.Errorf("QueryList return error!serviceName:%s cluster:%s err:%+v", serviceName, clusters, err) + logger.Errorf("QueryInstances error, serviceName:%s, cluster:%s, err:%v", serviceName, clusters, err) return } s.serviceInfoHolder.ProcessService(result) diff --git a/common/remote/rpc/connection.go b/common/remote/rpc/connection.go index 0d3cfd13..595633db 100644 --- a/common/remote/rpc/connection.go +++ b/common/remote/rpc/connection.go @@ -55,5 +55,5 @@ func (c *Connection) getAbandon() bool { } func (c *Connection) close() { - c.conn.Close() + _ = c.conn.Close() } diff --git a/common/remote/rpc/grpc_client.go b/common/remote/rpc/grpc_client.go index 2148d2ca..24c7cfdf 100644 --- a/common/remote/rpc/grpc_client.go +++ b/common/remote/rpc/grpc_client.go @@ -20,6 +20,7 @@ import ( "context" "encoding/json" "io" + "math" "os" "strconv" "sync" @@ -50,7 +51,7 @@ func NewGrpcClient(ctx context.Context, clientName string, nacosServer *nacos_se name: clientName, labels: make(map[string]string, 8), rpcClientStatus: INITIALIZED, - eventChan: make(chan ConnectionEvent), + eventChan: make(chan ConnectionEvent, math.MaxInt32), reconnectionChan: make(chan ReconnectContext), nacosServer: nacosServer, serverRequestHandlerMapping: make(map[string]ServerRequestHandlerMapping, 8), @@ -138,7 +139,7 @@ func (c *GrpcClient) connectToServer(serverInfo ServerInfo) (IConnection, error) client = nacos_grpc_service.NewRequestClient(conn) response, err := serverCheck(client) if err != nil { - conn.Close() + _ = conn.Close() return nil, errors.Errorf("server check request failed , err:%v", err) } serverCheckResponse := response.(*rpc_response.ServerCheckResponse) diff --git a/common/remote/rpc/server_request_handler.go b/common/remote/rpc/server_request_handler.go index a432d594..b99d316f 100644 --- a/common/remote/rpc/server_request_handler.go +++ b/common/remote/rpc/server_request_handler.go @@ -69,7 +69,7 @@ func (c *ClientDetectionRequestHandler) Name() string { return "ClientDetectionRequestHandler" } -func (c *ClientDetectionRequestHandler) RequestReply(request rpc_request.IRequest, rpcClient *RpcClient) rpc_response.IResponse { +func (c *ClientDetectionRequestHandler) RequestReply(request rpc_request.IRequest, _ *RpcClient) rpc_response.IResponse { _, ok := request.(*rpc_request.ClientDetectionRequest) if ok { return &rpc_response.ClientDetectionResponse{ @@ -87,7 +87,7 @@ func (*NamingPushRequestHandler) Name() string { return "NamingPushRequestHandler" } -func (c *NamingPushRequestHandler) RequestReply(request rpc_request.IRequest, rpcClient *RpcClient) rpc_response.IResponse { +func (c *NamingPushRequestHandler) RequestReply(request rpc_request.IRequest, _ *RpcClient) rpc_response.IResponse { notifySubscriberRequest, ok := request.(*rpc_request.NotifySubscriberRequest) if ok { c.ServiceInfoHolder.ProcessService(¬ifySubscriberRequest.ServiceInfo)