pull/458/head
wangchuxiao 2 years ago
parent c0af5152f1
commit 0eb1858408

@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"strings" "strings"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
@ -53,6 +54,7 @@ func RpcClientInterceptor(ctx context.Context, method string, req, resp interfac
} }
func getRpcContext(ctx context.Context, method string) (context.Context, error) { func getRpcContext(ctx context.Context, method string) (context.Context, error) {
ctx, _ = context.WithTimeout(ctx, time.Second*5)
md := metadata.Pairs() md := metadata.Pairs()
if keys, _ := ctx.Value(constant.RpcCustomHeader).([]string); len(keys) > 0 { if keys, _ := ctx.Value(constant.RpcCustomHeader).([]string); len(keys) > 0 {
for _, key := range keys { for _, key := range keys {

@ -25,6 +25,10 @@ func (r *Resolver) ResolveNowZK(o resolver.ResolveNowOptions) {
return return
} }
r.addrs = newConns r.addrs = newConns
if len(newConns) == 0 {
log.ZError(context.Background(), "conn is nil", nil)
return
}
if err := r.cc.UpdateState(resolver.State{Addresses: newConns}); err != nil { if err := r.cc.UpdateState(resolver.State{Addresses: newConns}); err != nil {
log.ZError(context.Background(), "UpdateState error, conns is nil from svr", err, "conns", newConns, "zk path", r.target.URL.Path) log.ZError(context.Background(), "UpdateState error, conns is nil from svr", err, "conns", newConns, "zk path", r.target.URL.Path)
return return

Loading…
Cancel
Save