SSE Patch 增量推送架构全链路实现

- web/sse_manager.py: asyncio.Queue 连接池 + broadcast + event_stream
- web/routers/sse_router.py: GET /api/events + POST /api/internal/collector-patch
- weather_sources.py: 采集后 POST patch 给 web
- Nginx polyweather.conf: /api/events proxy_buffering off
- frontend/api/events/route.ts: Next.js SSE 代理
- frontend/hooks/use-sse-patches.ts: EventSource + useLatestPatch + 重连
- LiveTemperatureThresholdChart: mergePatchIntoHourly 增量合并
- scan-terminal-query: 接入 SSE patch 更新行数据
- 新增 ssePatchArchitecture.test.ts 架构测试
This commit is contained in:
2569718930@qq.com
2026-05-26 10:39:17 +08:00
parent 14252915ab
commit 23882ac1ef
12 changed files with 808 additions and 111 deletions
+2
View File
@@ -16,6 +16,7 @@ from web.routers.auth import router as auth_router
from web.routers.ops import router as ops_router
from web.routers.payments import router as payments_router
from web.routers.scan import router as scan_router
from web.routers.sse_router import router as sse_router
from web.routers.system import router as system_router
from web.routes import router as legacy_router
from web.scan_terminal_service import start_scan_terminal_prewarm
@@ -37,6 +38,7 @@ def create_app() -> FastAPI:
core_app.include_router(auth_router)
core_app.include_router(analytics_router)
core_app.include_router(scan_router)
core_app.include_router(sse_router)
core_app.include_router(payments_router)
core_app.include_router(ops_router)
core_app.include_router(legacy_router)