[#419] rpc/client: Use provided context for client dial
In previous implementation `Client` passed `context.Background()` to `grpc.DialContext` function. This didn't allow to abort dial stage by the given context. Base dial context on the one provided with `WithContext` option. Fall back to using `context.Background` if context is not specified. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
2b89b7e798
commit
3a91383f24
3 changed files with 19 additions and 13 deletions
|
@ -68,11 +68,11 @@ func (g rwGRPC) WriteMessage(m message.Message) error {
|
|||
}
|
||||
|
||||
func (c *Client) initGRPC(info common.CallMethodInfo, prm *callParameters) (MessageReadWriter, error) {
|
||||
if err := c.createGRPCClient(); err != nil {
|
||||
if err := c.createGRPCClient(prm.ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rw, err := c.gRPCClient.Init(info, prm.callOpts...)
|
||||
rw, err := c.gRPCClient.Init(info, grpc.WithContext(prm.ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue