If DB has any concerts data (even expired), return it immediately and refresh in background. Start pre-warming at container startup so the scrape runs before the first user request. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from pydantic import BaseModel
|
||||
|
||||
from arte_api import fetch_concerts, get_concerts_by_category, invalidate_cache, CATEGORIES
|
||||
from arte_api import fetch_concerts, get_all_concerts, get_concerts_by_category, invalidate_cache, CATEGORIES
|
||||
from downloader import DownloadManager
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
@@ -56,6 +56,7 @@ async def lifespan(app: FastAPI):
|
||||
tasks = [
|
||||
asyncio.create_task(dm.start_worker()),
|
||||
asyncio.create_task(_auto_dl_loop()),
|
||||
asyncio.create_task(get_all_concerts()), # pre-warm cache at startup
|
||||
]
|
||||
yield
|
||||
for t in tasks:
|
||||
|
||||
Reference in New Issue
Block a user