fix(contrib): get nacos service of customize group name (#1798)

pull/1833/head
Jin Peng 3 years ago committed by GitHub
parent 9dec67bddd
commit 85800cedb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      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 {

Loading…
Cancel
Save