Fix: queue single document zone OCR runs instead of running them in the request

Rendering and OCR ran inside the HTTP request and could block other
requests for minutes. The action now validates, then queues the bulk
zone OCR operation for the selected file and returns its task id.
This commit is contained in:
stumpylog committed 2026-11-19 15:25:48 -08:00
1 parent a6b81b2d64
commit c5fdba73a1
11 files changed
+379 -483

No files matched your search

+4 -1
View File
@@ -1263,10 +1263,12 @@ def run_zone_ocr(
*,
template: int | None = None,
user: User | None = None,
resolve_latest: bool = True,
) -> Literal["OK"]:
"""
Run zone OCR within the tracked bulk operation task, then finish once for
the root documents that had a value written.
the root documents that had a value written. Root documents are run on
their newest version unless resolve_latest is False.
"""
written_ids: list[int] = []
try:
@@ -1275,6 +1277,7 @@ def run_zone_ocr(
document_id=document_id,
template_id=template,
requester=user,
resolve_latest=resolve_latest,
)
if written_id is not None:
written_ids.append(written_id)