set timeout on get too

This commit is contained in:
Alex Cheema
2025-01-27 06:05:40 +00:00
parent 4748bb7dc7
commit 265586f7b4

View File

@@ -89,7 +89,7 @@ async def download_file(session: aiohttp.ClientSession, repo_id: str, revision:
base_url = f"{get_hf_endpoint()}/{repo_id}/resolve/{revision}/"
url = urljoin(base_url, path)
headers = await get_auth_headers()
async with session.get(url, headers=headers) as r:
async with session.get(url, headers=headers, timeout=aiohttp.ClientTimeout(total=1800, connect=60, sock_read=1800, sock_connect=60)) as r:
assert r.status == 200, f"Failed to download {path} from {url}: {r.status}"
length = int(r.headers.get('content-length', 0))
n_read = 0