[#XX] api: Always call dialer on client connection

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-12-04 15:17:43 +03:00
parent cb813e27a8
commit ab885d2449

View file

@ -13,19 +13,17 @@ import (
var errInvalidEndpoint = errors.New("invalid endpoint options")
func (c *Client) openGRPCConn(ctx context.Context, dialer func(ctx context.Context, cc grpcstd.ClientConnInterface) error) error {
if c.conn != nil {
return nil
}
if c.conn == nil {
if c.addr == "" {
return errInvalidEndpoint
}
if c.addr == "" {
return errInvalidEndpoint
}
var err error
var err error
c.conn, err = grpcstd.NewClient(c.addr, c.grpcDialOpts...)
if err != nil {
return fmt.Errorf("gRPC new client: %w", err)
c.conn, err = grpcstd.NewClient(c.addr, c.grpcDialOpts...)
if err != nil {
return fmt.Errorf("gRPC new client: %w", err)
}
}
if dialer != nil {