支持优雅退出

This commit is contained in:
GoEdgeLab
2020-10-28 11:19:06 +08:00
parent 5b0ed31f2d
commit 4216f54ad3
19 changed files with 238 additions and 15 deletions

View File

@@ -122,6 +122,13 @@ func (this *RPCClient) ClusterContext(clusterId string, clusterSecret string) co
return ctx
}
// 关闭连接
func (this *RPCClient) Close() {
for _, conn := range this.conns {
_ = conn.Close()
}
}
// 随机选择一个连接
func (this *RPCClient) pickConn() *grpc.ClientConn {
if len(this.conns) == 0 {