Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: iteration node in parallel mode token count error (#11539)

Novice1765fe2a2994
diff --git a/api/core/workflow/nodes/iteration/iteration_node.py b/api/core/workflow/nodes/iteration/iteration_node.py
index 5b3853c5d62..cbabe7a3c56 100644
--- a/api/core/workflow/nodes/iteration/iteration_node.py
+++ b/api/core/workflow/nodes/iteration/iteration_node.py
@@ -182,7 +182,6 @@ class IterationNode(BaseNode[IterationNodeData]):
future.add_done_callback(thread_pool.task_done_callback)
futures.append(future)
succeeded_count = 0
- empty_count = 0
while True:
try:
event = q.get(timeout=1)
@@ -593,3 +592,4 @@ class IterationNode(BaseNode[IterationNodeData]):
parallel_mode_run_id=parallel_mode_run_id,
):
q.put(event)
+ graph_engine.graph_runtime_state.total_tokens += graph_engine_copy.graph_runtime_state.total_tokens