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:
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user