Merge remote-tracking branch 'origin/main-fix' into think_flow_test

This commit is contained in:
SengokuCola
2025-03-26 00:16:56 +08:00
parent 1b960b32b4
commit 681e1aa0fc
6 changed files with 160 additions and 66 deletions

2
bot.py
View File

@@ -139,12 +139,10 @@ async def graceful_shutdown():
uvicorn_server.force_exit = True # 强制退出
await uvicorn_server.shutdown()
logger.info("正在关闭所有任务...")
tasks = [t for t in asyncio.all_tasks() if t is not asyncio.current_task()]
for task in tasks:
task.cancel()
await asyncio.gather(*tasks, return_exceptions=True)
logger.info("所有任务已关闭")
except Exception as e:
logger.error(f"麦麦关闭失败: {e}")