feat: ad manager
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"lone-services/bff/internal/response"
|
||||
"lone-services/pkg/discovery"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
@@ -26,6 +27,11 @@ func Nacos(conf zrpc.RpcClientConf) zrpc.Client {
|
||||
return zrpc.MustNewClient(cliConf,
|
||||
zrpc.WithDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())),
|
||||
zrpc.WithDialOption(grpc.WithUnaryInterceptor(response.UserClientInterceptor)),
|
||||
// 等重连/重新 Pick
|
||||
zrpc.WithDialOption(grpc.WithDefaultCallOptions(grpc.WaitForReady(true))),
|
||||
zrpc.WithDialOption(grpc.WithConnectParams(grpc.ConnectParams{
|
||||
MinConnectTimeout: 2 * time.Second,
|
||||
})),
|
||||
zrpc.WithDialOption(grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) {
|
||||
inst, err := discovery.Pick(serviceName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user