未验证 提交 dd8d19d8 编写于 作者: Y Yaron Schneider 提交者: GitHub

return error on connection error (#58)

上级 1c6fa730
......@@ -794,7 +794,7 @@ func (i *Action) OnInvokeAction(c *routing.Context) {
var resp []byte
var err error
if i.isTargetLocal(targetAddress) {
if i.ActionID == actionID || i.isTargetLocal(targetAddress) {
resp, err = i.invoke(actionMethod, actionID, contextID, "", httpMethod, string(c.URI().QueryString()), payload, spanCtx)
} else {
conn, err := i.GetGRPCConnection(address)
......@@ -814,9 +814,16 @@ func (i *Action) OnInvokeAction(c *routing.Context) {
ctxMetadata := metadata.NewOutgoingContext(ctx, md)
client := pb.NewActionClient(conn)
r, err := client.Invoke(ctxMetadata, &pb.InvokeEnvelope{Data: &any.Any{Value: payload}})
if err != nil {
if !responseDelivered {
diag.SetSpanStatus(span, trace.StatusCodeInternal, fmt.Sprintf("Delivery to action id %s failed - %s", actionID, err.Error()))
RespondWithError(c.RequestCtx, 500, fmt.Sprintf("delivery to action id %s failed", actionID))
}
return
}
if r != nil && r.Data != nil {
resp = r.GetData().GetValue()
responseDelivered = true
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册