From 8f7753331752e72b17ef8f055318ab548a73f4b8 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 14 Jul 2026 01:00:24 -0400 Subject: [PATCH] refac --- backend/open_webui/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 754bcc8a5d..b8194544d6 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -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')