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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor: use thread.Timer instead of time.sleep (#33121)
wangxiaolei46098b2be6c4
diff --git a/api/core/app/task_pipeline/message_cycle_manager.py b/api/core/app/task_pipeline/message_cycle_manager.pyindex cc4f97ad94c..536ab02eae1 100644--- a/api/core/app/task_pipeline/message_cycle_manager.py+++ b/api/core/app/task_pipeline/message_cycle_manager.py@@ -1,7 +1,6 @@import hashlibimport logging-import time-from threading import Thread+from threading import Thread, Timerfrom typing import Unionfrom flask import Flask, current_app@@ -96,9 +95,9 @@ class MessageCycleManager:if auto_generate_conversation_name and is_first_message:# start generate thread# time.sleep not block other logic- time.sleep(1)- thread = Thread(- target=self._generate_conversation_name_worker,+ thread = Timer(+ 1,+ self._generate_conversation_name_worker,kwargs={"flask_app": current_app._get_current_object(), # type: ignore"conversation_id": conversation_id,diff --git a/api/tests/unit_tests/core/app/apps/test_advanced_chat_app_generator.py b/api/tests/unit_tests/core/app/apps/test_advanced_chat_app_generator.pyindex f0d9afc0db6..a25e3ec3f54 100644--- a/api/tests/unit_tests/core/app/apps/test_advanced_chat_app_generator.py+++ b/api/tests/unit_tests/core/app/apps/test_advanced_chat_app_generator.py@@ -124,12 +124,12 @@ def test_message_cycle_manager_uses_new_conversation_flag(monkeypatch):def start(self):self.started = True- def fake_thread(**kwargs):+ def fake_thread(*args, **kwargs):thread = DummyThread(**kwargs)captured["thread"] = threadreturn thread- monkeypatch.setattr(message_cycle_manager, "Thread", fake_thread)+ monkeypatch.setattr(message_cycle_manager, "Timer", fake_thread)manager = MessageCycleManager(application_generate_entity=entity, task_state=MagicMock())thread = manager.generate_conversation_name(conversation_id="existing-conversation-id", query="hello")