1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-24 22:26:54 +02:00

Add transport dial timeout

This commit is contained in:
Asim
2016-01-03 21:25:03 +00:00
parent 332a229169
commit d43d3e8efa
4 changed files with 32 additions and 8 deletions

@ -70,7 +70,7 @@ func (r *rpcClient) call(ctx context.Context, address string, request Request, r
return errors.InternalServerError("go.micro.client", err.Error())
}
c, err := r.opts.Transport.Dial(address)
c, err := r.opts.Transport.Dial(address, transport.WithTimeout(r.opts.DialTimeout))
if err != nil {
return errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
}
@ -116,7 +116,7 @@ func (r *rpcClient) stream(ctx context.Context, address string, req Request) (St
return nil, errors.InternalServerError("go.micro.client", err.Error())
}
c, err := r.opts.Transport.Dial(address, transport.WithStream())
c, err := r.opts.Transport.Dial(address, transport.WithStream(), transport.WithTimeout(r.opts.DialTimeout))
if err != nil {
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
}