refactor: 优化兴趣值管理器和统一调度器,增强任务执行的并发控制

This commit is contained in:
Windpicker-owo
2025-11-07 22:13:00 +08:00
parent ff5d14042c
commit 0cf7f87b66
6 changed files with 173 additions and 75 deletions

View File

@@ -41,19 +41,11 @@ class InterestManager:
async def initialize(self):
"""初始化管理器"""
if self._worker_task is None:
self._worker_task = asyncio.create_task(self._calculation_worker())
logger.info("兴趣值管理器已启动")
pass
async def shutdown(self):
"""关闭管理器"""
self._shutdown_event.set()
if self._worker_task:
self._worker_task.cancel()
try:
await self._worker_task
except asyncio.CancelledError:
pass
if self._current_calculator:
await self._current_calculator.cleanup()