This commit is contained in:
SengokuCola
2025-06-15 01:45:04 +08:00
3 changed files with 16 additions and 19 deletions

5
bot.py
View File

@@ -122,10 +122,7 @@ async def graceful_shutdown():
# 等待所有任务完成,设置超时 # 等待所有任务完成,设置超时
try: try:
await asyncio.wait_for( await asyncio.wait_for(asyncio.gather(*remaining_tasks, return_exceptions=True), timeout=15.0)
asyncio.gather(*remaining_tasks, return_exceptions=True),
timeout=15.0
)
logger.info("所有剩余任务已成功取消") logger.info("所有剩余任务已成功取消")
except asyncio.TimeoutError: except asyncio.TimeoutError:
logger.warning("等待任务取消超时,强制继续关闭") logger.warning("等待任务取消超时,强制继续关闭")