This commit is contained in:
2026-05-04 13:13:01 +02:00
parent 48d57c31e1
commit d25b56e7e1
22 changed files with 99 additions and 161 deletions

View File

@@ -229,6 +229,11 @@ async def startup_shared_resources(
lambda: _stage_create_scheduler(),
)
# Store resources on app.state BEFORE registering tasks (tasks depend on them)
app.state.http_session = http_session
app.state.geo_cache = geo_cache
app.state.scheduler = scheduler
# Stage 6: Register tasks
await dag.execute_stage(
StartupStage.TASKS,
@@ -239,9 +244,6 @@ async def startup_shared_resources(
if not await dag.health_check():
raise RuntimeError("Startup health check failed")
# Store the geo_cache on app state for dependency injection
app.state.geo_cache = geo_cache
log.info(
"startup_completed_successfully",
stages=len(dag.context.completed_stages),
@@ -469,8 +471,6 @@ async def _stage_register_tasks(app: FastAPI, scheduler: AsyncIOScheduler) -> No
app: The FastAPI application instance.
scheduler: The APScheduler scheduler to register tasks with.
"""
# Set scheduler on app.state before registering tasks (they use app.state.scheduler)
app.state.scheduler = scheduler
scheduler_lock_heartbeat.register(app)
health_check.register(app)
await blocklist_import.register(app)