code: func (cp *connProducer) NewConnection() (*grpc.ClientConn, string, error) {
  	cp.Lock()
  	defer cp.Unlock()
  
  	for endpoint, timeout := range cp.disabledEndpoints {
  		if time.Since(timeout) >= EndpointDisableInterval {
  			delete(cp.disabledEndpoints, endpoint)
  		}
  	}
  
  	endpoints := shuffle(cp.endpoints)
  	checkedEndpoints := make([]string, 0)
  	for _, endpoint := range endpoints {
  		if _, ok := cp.disabledEndpoints[endpoint]; !ok {
  			checkedEndpoints = append(checkedEndpoints, endpoint)
  			conn, err := cp.connect(endpoint)
  			if err != nil {
  				logger.Error("Failed connecting to", endpoint, ", error:", err)
  				continue
  			}
  			return conn, endpoint, nil
  		}
  	}
  	return nil, "", fmt.Errorf("Could not connect to any of the endpoints: %v", checkedEndpoints)
  }
docs: // NewConnection creates a new connection.
  // Returns the connection, the endpoint selected, nil on success.
  // Returns nil, "", error on failure