This commit is contained in:
Timothy Jaeryang Baek
2026-07-14 01:00:24 -04:00
parent 410ebb05d4
commit 8f77533317
+10 -1
View File
@@ -320,8 +320,9 @@ async def lifespan(app: FastAPI):
await migrate_legacy_webhook_config()
await publish_event(app, EVENTS.SYSTEM_STARTUP_STARTED, source='system')
license_task = None
if LICENSE_KEY:
get_license_data(app, LICENSE_KEY)
license_task = asyncio.create_task(asyncio.to_thread(get_license_data, app, LICENSE_KEY))
# Create admin account from env vars if specified and no users exist
if WEBUI_ADMIN_EMAIL and WEBUI_ADMIN_PASSWORD:
@@ -409,6 +410,14 @@ async def lifespan(app: FastAPI):
log.warning(f'Failed to initialize terminal servers at startup: {e}')
# Mark application as ready to accept traffic from a startup perspective.
if license_task:
try:
await asyncio.wait_for(asyncio.shield(license_task), timeout=2)
except asyncio.TimeoutError:
log.warning('License data retrieval is still pending; continuing startup without it')
except Exception as e:
log.warning(f'License data retrieval failed during startup: {e}')
app.state.startup_complete = True
await publish_event(app, EVENTS.SYSTEM_STARTUP_COMPLETED, source='system')