backup
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user