fix: 修复爬虫网络层、验证队列卡死及 API 500 错误
- 修复 BaseHTTPPlugin 连接池、并发控制、异常日志、超时策略 - 修复/增强 8 个爬虫插件的稳定性和 fallback 机制 - 清理 validation_tasks 表 4 万+ pending 任务,避免队列卡死 - 修复 app/api/main.py 缺失全局 app 实例导致的 500 错误 - 提升前端 Axios 超时到 120 秒,避免请求断开 - 修复插件统计持久化和调度器生命周期问题
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""应用生命周期管理"""
|
||||
import asyncio
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
from app.core.db import init_db, get_db
|
||||
@@ -37,6 +38,12 @@ async def lifespan(app: FastAPI):
|
||||
yield
|
||||
|
||||
# 关闭调度器
|
||||
if scheduler_service._validate_task and not scheduler_service._validate_task.done():
|
||||
scheduler_service._validate_task.cancel()
|
||||
try:
|
||||
await scheduler_service._validate_task
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
await scheduler_service.stop()
|
||||
await scheduler_service.validation_queue.validator.close()
|
||||
logger.info("API server shutdown")
|
||||
|
||||
Reference in New Issue
Block a user