소스 검색

fix: GetDialInsecure 使用endpointNameKey作为key

dcsunny 1 년 전
부모
커밋
42b469e99c
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  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
 }