tianxiaoliang commented on a change in pull request #1205:
URL: 
https://github.com/apache/servicecomb-service-center/pull/1205#discussion_r780086179



##########
File path: client/set.go
##########
@@ -19,13 +28,35 @@ type Set struct {
 }
 
 // NewSetForConfig dial grpc connection and create all grpc clients
-func NewSetForConfig(c SetConfig) (*Set, error) {
-       conn, err := grpc.Dial(c.Addr, grpc.WithInsecure())
+func NewSetForConfig(c SetConfig) (*grpc.ClientConn, *Set, error) {
+       if len(c.Addr) <= 0 {
+               return nil, nil, ErrAddrEmpty
+       }
+
+       var conn *grpc.ClientConn
+       var err error
+
+       if len(c.Addr) <= 1 {
+               conn, err = grpc.Dial(c.Addr[0], grpc.WithInsecure())
+       } else {
+               addr := make([]resolver.Address, 0, len(c.Addr))

Review comment:
       不必维护分支,都是resolver,之所以可以代码合一是因为用例就一个:拨集群




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to