mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-02 18:34:29 +08:00
feat: multiple address
This commit is contained in:
parent
6aaf79c517
commit
898dde9bb8
@ -16,6 +16,7 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
@ -43,7 +44,7 @@ import (
|
||||
)
|
||||
|
||||
func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.UniversalClient) *gin.Engine {
|
||||
discov.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) // 默认RPC中间件
|
||||
discov.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin"))) // 默认RPC中间件
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
r := gin.New()
|
||||
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
|
||||
|
||||
@ -75,6 +75,7 @@ func NewConnManager() (*ConnManager, error) {
|
||||
|
||||
func (cm *ConnManager) GetConns(ctx context.Context,
|
||||
serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) {
|
||||
|
||||
if conns, exists := cm.conns[serviceName]; exists {
|
||||
return conns, nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user