From 332632ab9f75758744a0bdefddcb02e9e1526446 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 13 Nov 2020 18:22:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96RPC=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/build.sh | 4 ++++ internal/rpc/rpc_client.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/build/build.sh b/build/build.sh index 31e0d24..cd11575 100755 --- a/build/build.sh +++ b/build/build.sh @@ -43,6 +43,10 @@ function build() { echo "building ..." env GOOS=${OS} GOARCH=${ARCH} go build -o $DIST/bin/${NAME} -ldflags="-s -w" $ROOT/../cmd/edge-node/main.go + # delete hidden files + find $DIST -name ".DS_Store" -delete + find $DIST -name ".gitignore" -delete + echo "zip files" cd "${DIST}/../" || exit if [ -f "${ZIP}" ]; then diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go index a595192..8e63464 100644 --- a/internal/rpc/rpc_client.go +++ b/internal/rpc/rpc_client.go @@ -190,6 +190,11 @@ func (this *RPCClient) pickConn() *grpc.ClientConn { if len(availableConns) > 0 { return availableConns[rands.Int(0, len(availableConns)-1)] } + + // 关闭 + for _, conn := range this.conns { + _ = conn.Close() + } } // 重新初始化