From de2f3a8582cb0905901ac82a960e1fdcead2673e Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 9 May 2023 20:05:56 +0800 Subject: [PATCH] conn --- go.mod | 2 +- go.sum | 2 ++ internal/api/group.go | 2 ++ pkg/discoveryregistry/discovery_register.go | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 1e8293056..81b27f38d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( firebase.google.com/go v3.13.0+incompatible - github.com/OpenIMSDK/openKeeper v0.9.9-0.20230426053850-80d254440004 + github.com/OpenIMSDK/openKeeper v0.9.9-0.20230509114426-eb05252b1e67 github.com/OpenIMSDK/open_utils v1.0.8 github.com/Shopify/sarama v1.32.0 github.com/antonfisher/nested-logrus-formatter v1.3.1 diff --git a/go.sum b/go.sum index 20ecd88bb..bde1b45fe 100644 --- a/go.sum +++ b/go.sum @@ -391,6 +391,8 @@ github.com/OpenIMSDK/openKeeper v0.0.6 h1:0eseL/h+evxZAM5Dqs85FEDbDFkTjpVwHBSINQ github.com/OpenIMSDK/openKeeper v0.0.6/go.mod h1:HwHgo+p3E+aAeiLOSyDwVB2zFJtu+QvnFNlfNjFG9vA= github.com/OpenIMSDK/openKeeper v0.9.9-0.20230426053850-80d254440004 h1:+1t9eKPKV/NyQARgVUv6TgOWSf8uKu8rkS41+utSIMk= github.com/OpenIMSDK/openKeeper v0.9.9-0.20230426053850-80d254440004/go.mod h1:HwHgo+p3E+aAeiLOSyDwVB2zFJtu+QvnFNlfNjFG9vA= +github.com/OpenIMSDK/openKeeper v0.9.9-0.20230509114426-eb05252b1e67 h1:I6QLciX4LlavBMNyeqkp90DJV+uKcwke7NZ9OKMIjV8= +github.com/OpenIMSDK/openKeeper v0.9.9-0.20230509114426-eb05252b1e67/go.mod h1:HwHgo+p3E+aAeiLOSyDwVB2zFJtu+QvnFNlfNjFG9vA= github.com/OpenIMSDK/open_utils v1.0.8 h1:IopxWgJwEF5ZAPsRuiZZOfcxNOQOCt/p8VDENcHN9r4= github.com/OpenIMSDK/open_utils v1.0.8/go.mod h1:FLoaQblWUVKQgqt2LrNzfSZLT6D3DICBn1kcOMDLUOI= github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE= diff --git a/internal/api/group.go b/internal/api/group.go index bd517d050..d5c9d1f30 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -5,6 +5,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" @@ -26,6 +27,7 @@ func (o *Group) client(ctx context.Context) (group.GroupClient, error) { if err != nil { return nil, err } + log.ZDebug(ctx, "get conn", o.c.GetClientLocalConns()) return group.NewGroupClient(conn), nil } diff --git a/pkg/discoveryregistry/discovery_register.go b/pkg/discoveryregistry/discovery_register.go index 31eae9ead..880e31e20 100644 --- a/pkg/discoveryregistry/discovery_register.go +++ b/pkg/discoveryregistry/discovery_register.go @@ -4,12 +4,15 @@ import ( "context" "google.golang.org/grpc" + "google.golang.org/grpc/resolver" ) type Conn interface { GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) AddOption(opts ...grpc.DialOption) + // do not use this method for call rpc + GetClientLocalConns() map[string][]resolver.Address } type SvcDiscoveryRegistry interface {