Увеличил таймаут на загрузку картинок

This commit is contained in:
urec56 2024-10-19 23:31:35 +03:00
parent 150a6ee2a8
commit 6edbd9482d

View file

@ -11,8 +11,12 @@ class ImageService:
async def upload_file(file: UploadFile, remote_server_url: str) -> Response:
try:
file_content = await file.read()
async with AsyncClient() as client:
response = await client.post(remote_server_url, files={"file": file_content})
async with AsyncClient() as ac:
response = await ac.post(
remote_server_url,
files={"file": file_content},
timeout=20,
)
if response.status_code != 200:
raise HTTPException(status_code=response.status_code, detail=response.json()["detail"])
return response