From 0bd9d59c78213ad2b3cd9c1440bef5ca5d619edc Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 27 Sep 2024 14:38:56 +0200 Subject: [PATCH] refac: update check timeout --- backend/open_webui/main.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 4af48906b..ca829cfa1 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -2153,7 +2153,8 @@ async def get_app_changelog(): @app.get("/api/version/updates") async def get_app_latest_release_version(): try: - async with aiohttp.ClientSession(trust_env=True) as session: + timeout = aiohttp.ClientTimeout(total=1) + async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session: async with session.get( "https://api.github.com/repos/open-webui/open-webui/releases/latest" ) as response: @@ -2163,10 +2164,7 @@ async def get_app_latest_release_version(): return {"current": VERSION, "latest": latest_version[1:]} except aiohttp.ClientError: - raise HTTPException( - status_code=status.HTTP_503_SERVICE_UNAVAILABLE, - detail=ERROR_MESSAGES.RATE_LIMIT_EXCEEDED, - ) + return {"current": VERSION, "latest": VERSION} ############################