avant 50
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import os
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
@@ -23,15 +24,22 @@ async def lifespan(app: FastAPI):
|
||||
from app.seed import run_seed
|
||||
run_seed()
|
||||
if ENABLE_SCHEDULER:
|
||||
from app.services.scheduler import setup_scheduler
|
||||
from app.services.scheduler import setup_scheduler, backfill_station_missing_dates
|
||||
setup_scheduler()
|
||||
# Backfill des dates manquantes en arrière-plan (ne bloque pas le démarrage)
|
||||
loop = asyncio.get_running_loop()
|
||||
loop.run_in_executor(None, backfill_station_missing_dates)
|
||||
yield
|
||||
if ENABLE_BOOTSTRAP and ENABLE_SCHEDULER:
|
||||
from app.services.scheduler import scheduler
|
||||
scheduler.shutdown(wait=False)
|
||||
|
||||
|
||||
app = FastAPI(title="Jardin API", lifespan=lifespan)
|
||||
app = FastAPI(
|
||||
title="Jardin API",
|
||||
lifespan=lifespan,
|
||||
redoc_js_url="https://cdn.jsdelivr.net/npm/redoc@2.1.3/bundles/redoc.standalone.js"
|
||||
)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
|
||||
Reference in New Issue
Block a user