fix: connection timeout

This commit is contained in:
Timothy J. Baek
2024-05-17 10:49:12 -07:00
parent fa54eb687e
commit 014e52c072
2 changed files with 4 additions and 2 deletions

View File

@@ -124,8 +124,9 @@ async def cancel_ollama_request(request_id: str, user=Depends(get_current_user))
async def fetch_url(url):
timeout = aiohttp.ClientTimeout(total=5)
try:
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(timeout=timeout) as session:
async with session.get(url) as response:
return await response.json()
except Exception as e: