From 85800cedb9620bbe5f421ede3f7e4a0706ddc40a Mon Sep 17 00:00:00 2001 From: Jin Peng <554085731@qq.com> Date: Tue, 22 Feb 2022 10:51:47 +0800 Subject: [PATCH] fix(contrib): get nacos service of customize group name (#1798) --- contrib/registry/nacos/registry.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/registry/nacos/registry.go b/contrib/registry/nacos/registry.go index baf9b473e..088cb8c28 100644 --- a/contrib/registry/nacos/registry.go +++ b/contrib/registry/nacos/registry.go @@ -8,6 +8,7 @@ import ( "strconv" "github.com/nacos-group/nacos-sdk-go/clients/naming_client" + "github.com/nacos-group/nacos-sdk-go/common/constant" "github.com/nacos-group/nacos-sdk-go/vo" "github.com/go-kratos/kratos/v2/registry" @@ -65,7 +66,7 @@ func New(cli naming_client.INamingClient, opts ...Option) (r *Registry) { op := options{ prefix: "/microservices", cluster: "DEFAULT", - group: "DEFAULT_GROUP", + group: constant.DEFAULT_GROUP, weight: 100, kind: "grpc", } @@ -167,6 +168,7 @@ func (r *Registry) Watch(ctx context.Context, serviceName string) (registry.Watc func (r *Registry) GetService(_ context.Context, serviceName string) ([]*registry.ServiceInstance, error) { res, err := r.cli.SelectInstances(vo.SelectInstancesParam{ ServiceName: serviceName, + GroupName: r.opts.group, HealthyOnly: true, }) if err != nil {