Fix test failures and workload/websocket behavior

This commit is contained in:
beabigegg
2026-01-11 08:37:21 +08:00
parent 3bdc6ff1c9
commit f5f870da56
49 changed files with 3006 additions and 1132 deletions

View File

@@ -1,3 +1,4 @@
import os
from contextlib import asynccontextmanager
from datetime import datetime
from fastapi import FastAPI, Request, APIRouter
@@ -16,11 +17,16 @@ from app.core.deprecation import DeprecationMiddleware
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Manage application lifespan events."""
testing = os.environ.get("TESTING", "").lower() in ("true", "1", "yes")
scheduler_disabled = os.environ.get("DISABLE_SCHEDULER", "").lower() in ("true", "1", "yes")
start_background_jobs = not testing and not scheduler_disabled
# Startup
start_scheduler()
if start_background_jobs:
start_scheduler()
yield
# Shutdown
shutdown_scheduler()
if start_background_jobs:
shutdown_scheduler()
from app.api.auth import router as auth_router