Jelajahi Sumber

fix: GetDialInsecure 使用endpointNameKey作为key

dcsunny 1 tahun lalu
induk
melakukan
42b469e99c
1 mengubah file dengan 5 tambahan dan 5 penghapusan
  1. 5 5
      grpc/client.go

+ 5 - 5
grpc/client.go

@@ -36,7 +36,7 @@ func GetDialInsecure(
 		return nil, nil
 	}
 	ConnLock.Lock()
-	conn, ok := ConnMap[clientName]
+	conn, ok := ConnMap[endpointNameKey]
 	ConnLock.Unlock()
 	if ok {
 		return conn, nil
@@ -53,15 +53,15 @@ func GetDialInsecure(
 		return nil, err
 	}
 	ConnLock.Lock()
-	ConnMap[clientName] = conn
+	ConnMap[endpointNameKey] = conn
 	ConnLock.Unlock()
 	return conn, nil
 }
 
-func GetDialSimple(clientName string, endpoint string, option *DialOption) (*grpc2.ClientConn, error) {
+func GetDialSimple(endpointNameKey string, endpoint string, option *DialOption) (*grpc2.ClientConn, error) {
 	option = checkOption(option)
 	ConnLock.Lock()
-	conn, ok := ConnMap[clientName]
+	conn, ok := ConnMap[endpointNameKey]
 	ConnLock.Unlock()
 	if ok {
 		return conn, nil
@@ -77,7 +77,7 @@ func GetDialSimple(clientName string, endpoint string, option *DialOption) (*grp
 		return nil, err
 	}
 	ConnLock.Lock()
-	ConnMap[clientName] = conn
+	ConnMap[endpointNameKey] = conn
 	ConnLock.Unlock()
 	return conn, nil
 }