mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 10:52:33 +08:00
feat: multiple addresses
This commit is contained in:
parent
3d81042da7
commit
2c9caf0845
@ -153,7 +153,7 @@ func checkServiceHealth(address string) bool {
|
||||
|
||||
const (
|
||||
slashSeparator = "/"
|
||||
// EndpointSepChar is the separator cha in endpoints.
|
||||
// EndpointSepChar is the separator char in endpoints.
|
||||
EndpointSepChar = ','
|
||||
|
||||
subsetSize = 32
|
||||
@ -188,12 +188,14 @@ func (n nopResolver) Close() {
|
||||
|
||||
func (cm *ConnManager) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (
|
||||
resolver.Resolver, error) {
|
||||
|
||||
endpoints := strings.FieldsFunc(GetEndpoints(target), func(r rune) bool {
|
||||
return r == EndpointSepChar
|
||||
})
|
||||
log.ZDebug(context.Background(), "Build", "endpoints", endpoints)
|
||||
endpoints = subset(endpoints, subsetSize)
|
||||
addrs := make([]resolver.Address, 0, len(endpoints))
|
||||
|
||||
log.ZDebug(context.Background(), "Build", "addrs", addrs)
|
||||
for _, val := range endpoints {
|
||||
addrs = append(addrs, resolver.Address{
|
||||
Addr: val,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user