fix: resolved the issue of not releasing ThreadPoolExecutor when an exception occurs in _generate_worker

Signed-off-by: Guowen.Bao <Guowen.Bao@desaysv.com>
This commit is contained in:
Guowen.Bao 2025-02-28 15:39:17 +08:00
parent a9e4f345e9
commit 526f6321d1

View File

@ -169,6 +169,7 @@ class GraphEngine:
error=item.route_node_state.failed_reason or "Unknown error.",
exceptions_count=len(handle_exceptions),
)
self._release_thread()
return
elif isinstance(item, NodeRunSucceededEvent):
if item.node_type == NodeType.END:
@ -195,6 +196,7 @@ class GraphEngine:
except Exception as e:
logger.exception("Graph run failed")
yield GraphRunFailedEvent(error=str(e), exceptions_count=len(handle_exceptions))
self._release_thread()
return
# count exceptions to determine partial success
if len(handle_exceptions) > 0: