mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-01 15:18:59 +08:00
Add etcd as a service discovery mechanism
This commit is contained in:
parent
e6c2bb0b6e
commit
bb0da645a7
@ -100,7 +100,7 @@ func (r *SvcDiscoveryRegistryImpl) GetConns(ctx context.Context, serviceName str
|
|||||||
|
|
||||||
for _, kv := range resp.Kvs {
|
for _, kv := range resp.Kvs {
|
||||||
endpoint := string(kv.Key[len(fullServiceKey)+1:]) // Extract the endpoint address
|
endpoint := string(kv.Key[len(fullServiceKey)+1:]) // Extract the endpoint address
|
||||||
target := fmt.Sprintf("etcd://%s", endpoint)
|
target := fmt.Sprintf("etcd://%s/%s/%s", r.rootDirectory, serviceName, endpoint)
|
||||||
conn, err := grpc.DialContext(ctx, target, append(append(r.dialOptions, opts...), grpc.WithResolvers(r.resolver))...)
|
conn, err := grpc.DialContext(ctx, target, append(append(r.dialOptions, opts...), grpc.WithResolvers(r.resolver))...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("DialContext ", target, err.Error())
|
fmt.Println("DialContext ", target, err.Error())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user