fix(extract): scale kordoc timeout by file size for large PDFs

대형 PDF(14~40MB)에서 kordoc 파싱 timeout(60초) 실패하던 문제.
10MB당 60초 추가, 최소 60초 최대 300초로 조정.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-14 06:47:22 +09:00
parent 3c5844e287
commit ee74a9ba78
+3 -1
View File
@@ -58,7 +58,9 @@ async def process(document_id: int, session: AsyncSession) -> None:
if fmt in KORDOC_FORMATS:
# 컨테이너 내부 경로: /documents/{file_path}
container_path = f"/documents/{doc.file_path}"
async with httpx.AsyncClient(timeout=60) as client:
# 대형 PDF 대응: 10MB당 60초, 최소 60초 최대 300초
kordoc_timeout = min(300, max(60, (doc.file_size or 0) // (10 * 1024 * 1024) * 60 + 60))
async with httpx.AsyncClient(timeout=kordoc_timeout) as client:
resp = await client.post(
f"{settings.kordoc_endpoint}/parse",
json={"filePath": container_path},