浏览代码

refac: update check timeout

Timothy J. Baek 7 月之前
父节点
当前提交
0bd9d59c78
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      backend/open_webui/main.py

+ 3 - 5
backend/open_webui/main.py

@@ -2153,7 +2153,8 @@ async def get_app_changelog():
 @app.get("/api/version/updates")
 @app.get("/api/version/updates")
 async def get_app_latest_release_version():
 async def get_app_latest_release_version():
     try:
     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(
             async with session.get(
                 "https://api.github.com/repos/open-webui/open-webui/releases/latest"
                 "https://api.github.com/repos/open-webui/open-webui/releases/latest"
             ) as response:
             ) as response:
@@ -2163,10 +2164,7 @@ async def get_app_latest_release_version():
 
 
                 return {"current": VERSION, "latest": latest_version[1:]}
                 return {"current": VERSION, "latest": latest_version[1:]}
     except aiohttp.ClientError:
     except aiohttp.ClientError:
-        raise HTTPException(
-            status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
-            detail=ERROR_MESSAGES.RATE_LIMIT_EXCEEDED,
-        )
+        return {"current": VERSION, "latest": VERSION}
 
 
 
 
 ############################
 ############################