refactor: bound shared thread pool shutdown

This commit is contained in:
jxxghp
2026-08-24 14:51:38 +08:00
parent ad45bfac5d
commit 8826219173
7 changed files with 229 additions and 16 deletions
+12
View File
@@ -969,6 +969,18 @@ def test_stop_modules_propagates_message_queue_nonconvergence(monkeypatch):
_assert_completed_once(dependency)
def test_stop_modules_propagates_shared_thread_pool_nonconvergence(monkeypatch):
"""共享线程池仍有活动 Future 时必须由模块服务关闭结果向上暴露。"""
dependencies = _patch_module_shutdown_dependencies(monkeypatch)
dependencies["thread"].return_value = False
converged = asyncio.run(modules_initializer.stop_modules())
assert converged is False
for dependency in dependencies.values():
_assert_completed_once(dependency)
def test_stop_modules_drains_web_agent_tasks_before_persistence(monkeypatch):
"""关闭时先收口 Web Agent,再关闭持久化准入和数据库任务。"""
order = []