fix: workflow onEndWithStream handles stream asynchronously (#518)
This commit is contained in:
parent
08d1f6bf67
commit
3fe4031531
|
|
@ -496,7 +496,7 @@ func (w *WorkflowHandler) OnEndWithStreamOutput(ctx context.Context, info *callb
|
|||
return ctx
|
||||
}
|
||||
|
||||
// consumes the stream synchronously because the Exit node has already processed this stream synchronously.
|
||||
safego.Go(ctx, func() {
|
||||
defer output.Close()
|
||||
fullOutput := make(map[string]any)
|
||||
for {
|
||||
|
|
@ -512,12 +512,12 @@ func (w *WorkflowHandler) OnEndWithStreamOutput(ctx context.Context, info *callb
|
|||
|
||||
logs.Errorf("workflow OnEndWithStreamOutput failed to receive stream output: %v", e)
|
||||
_ = w.OnError(ctx, info, e)
|
||||
return ctx
|
||||
return
|
||||
}
|
||||
fullOutput, e = nodes.ConcatTwoMaps(fullOutput, chunk.(map[string]any))
|
||||
if e != nil {
|
||||
logs.Errorf("failed to concat two maps: %v", e)
|
||||
return ctx
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -538,6 +538,7 @@ func (w *WorkflowHandler) OnEndWithStreamOutput(ctx context.Context, info *callb
|
|||
}
|
||||
}
|
||||
w.ch <- e
|
||||
})
|
||||
|
||||
return ctx
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue