refactor: use thread.Timer instead of time.sleep (#33121)

This commit is contained in:
wangxiaolei
2026-03-09 09:38:16 +08:00
committed by GitHub
parent 7dcf94f48f
commit 46098b2be6
2 changed files with 6 additions and 7 deletions

View File

@ -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"] = thread
return 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")