when the stream errors cleanup the connection (#1199)
This commit is contained in:
parent
cbe8b7dd09
commit
c691d116ab
@ -218,6 +218,12 @@ func (g *grpcClient) stream(ctx context.Context, node *registry.Node, req client
|
|||||||
|
|
||||||
st, err := cc.NewStream(newCtx, desc, methodToGRPC(req.Service(), req.Endpoint()), grpcCallOptions...)
|
st, err := cc.NewStream(newCtx, desc, methodToGRPC(req.Service(), req.Endpoint()), grpcCallOptions...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// we need to cleanup as we dialled and created a context
|
||||||
|
// cancel the context
|
||||||
|
cancel()
|
||||||
|
// close the connection
|
||||||
|
cc.Close()
|
||||||
|
// now return the error
|
||||||
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error creating stream: %v", err))
|
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error creating stream: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user