feat: ad manager

This commit is contained in:
zzw
2026-08-21 17:38:39 +08:00
parent f05656580c
commit caafc455bb
34 changed files with 454 additions and 300 deletions
+6
View File
@@ -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 {