refac
This commit is contained in:
1 parent
410ebb05d4
commit
8f77533317
1 file changed
+10
-1
@@ -320,8 +320,9 @@ async def lifespan(app: FastAPI):
|
|||||||
await migrate_legacy_webhook_config()
|
await migrate_legacy_webhook_config()
|
||||||
await publish_event(app, EVENTS.SYSTEM_STARTUP_STARTED, source='system')
|
await publish_event(app, EVENTS.SYSTEM_STARTUP_STARTED, source='system')
|
||||||
|
|
||||||
|
license_task = None
|
||||||
if LICENSE_KEY:
|
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
|
# Create admin account from env vars if specified and no users exist
|
||||||
if WEBUI_ADMIN_EMAIL and WEBUI_ADMIN_PASSWORD:
|
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}')
|
log.warning(f'Failed to initialize terminal servers at startup: {e}')
|
||||||
|
|
||||||
# Mark application as ready to accept traffic from a startup perspective.
|
# 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
|
app.state.startup_complete = True
|
||||||
await publish_event(app, EVENTS.SYSTEM_STARTUP_COMPLETED, source='system')
|
await publish_event(app, EVENTS.SYSTEM_STARTUP_COMPLETED, source='system')
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user