Skip to content

Commit ff26835

Browse files
authored
fix: Error in total time consumption statistics for executing records (#4459)
1 parent 1869b47 commit ff26835

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

apps/application/flow/i_step_node.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ def __init__(self, chat_info, knowledge_action_id):
105105
self.knowledge_action_id = knowledge_action_id
106106

107107
def handler(self, workflow):
108+
err = [True for key, value in workflow.get_runtime_details().items() if value.get('status') == 500]
108109
QuerySet(KnowledgeAction).filter(id=self.knowledge_action_id).update(
109-
state=State.SUCCESS)
110+
state=State.FAILURE if any(err) else State.SUCCESS,
111+
run_time=time.time() - workflow.context.get('start_time') if workflow.context.get(
112+
'start_time') is not None else 0)
110113

111114

112115
class NodeResult:

apps/application/flow/knowledge_workflow_manage.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2025/11/13 19:02
77
@desc:
88
"""
9+
import time
910
import traceback
1011
from concurrent.futures import ThreadPoolExecutor
1112

@@ -43,6 +44,7 @@ def get_start_node(self):
4344
return start_node_list[0]
4445

4546
def run(self):
47+
self.context['start_time'] = time.time()
4648
executor.submit(self._run)
4749

4850
def _run(self):

0 commit comments

Comments
 (0)