From 5237607abaf5bbef177707a505067adc3c4c54e5 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 19 Oct 2022 17:54:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E8=B7=A8=E6=9C=8D=E8=B0=83?= =?UTF-8?q?=E7=94=A8=20=E8=87=AA=E5=B7=B1=E8=B0=83=E7=94=A8=E8=87=AA?= =?UTF-8?q?=E5=B7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lego/base/rpcx/service.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lego/base/rpcx/service.go b/lego/base/rpcx/service.go index c06cb5b2e..fc37ba59f 100644 --- a/lego/base/rpcx/service.go +++ b/lego/base/rpcx/service.go @@ -165,6 +165,10 @@ func (this *RPCXService) RpcGo(ctx context.Context, servicePath string, serviceM ///servicePath = worker/[worker_1,worker_2] 表示随机选择[]里面的服务节点执行rpc方法 ///servicePath = worker/![worker_1,worker_2] 表示随机选择非[]里面的服务节点执行rpc方法 func (this *RPCXService) AcrossClusterRpcCall(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) { + if clusterTag == this.GetTag() { + err = fmt.Errorf("RPC equal clusterTag:%s ", clusterTag) + return + } return rpcx.AcrossClusterCall(ctx, clusterTag, servicePath, serviceMethod, args, reply) } @@ -176,6 +180,10 @@ func (this *RPCXService) AcrossClusterRpcCall(ctx context.Context, clusterTag st ///servicePath = worker/[worker_1,worker_2] 表示随机选择[]里面的服务节点执行rpc方法 ///servicePath = worker/![worker_1,worker_2] 表示随机选择非[]里面的服务节点执行rpc方法 func (this *RPCXService) AcrossClusterRpcGo(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (call *client.Call, err error) { + if clusterTag == this.GetTag() { + err = fmt.Errorf("RPC equal clusterTag:%s ", clusterTag) + return + } return rpcx.AcrossClusterGo(ctx, clusterTag, servicePath, serviceMethod, args, reply, nil) } @@ -187,6 +195,10 @@ func (this *RPCXService) AcrossClusterRpcGo(ctx context.Context, clusterTag stri ///servicePath = worker/[worker_1,worker_2] 表示随机选择[]里面的服务节点执行rpc方法 ///servicePath = worker/![worker_1,worker_2] 表示随机选择非[]里面的服务节点执行rpc方法 func (this *RPCXService) AcrossClusterBroadcast(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) { + if clusterTag == this.GetTag() { + err = fmt.Errorf("RPC equal clusterTag:%s ", clusterTag) + return + } return rpcx.AcrossClusterBroadcast(ctx, clusterTag, servicePath, serviceMethod, args, reply) }