From a3dd329e91e5c2be634d1dc9f7e14dc6425544bf Mon Sep 17 00:00:00 2001 From: skyhackvip <369983954@qq.com> Date: Thu, 22 Feb 2024 11:47:37 +0800 Subject: [PATCH] fix bug goroutine --- core/flow.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/flow.go b/core/flow.go index 55fd495..68951ee 100644 --- a/core/flow.go +++ b/core/flow.go @@ -71,13 +71,11 @@ func (flow *DecisionFlow) GetStartNode() (*FlowNode, bool) { func (flow *DecisionFlow) Run(ctx *PipelineContext) (err error) { //recover - go func() { - defer func() { - if err := recover(); err != nil { - err = err - log.Error(err) - } - }() + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("recovered from panic: %v", r) + log.Error(err) + } }() //find StartNode