From 8f88548a593aa8153403fbd562f3990569af9e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gremaud?= Date: Sun, 23 Nov 2025 12:20:59 +0100 Subject: [PATCH] single OCR thread in // --- opus_submitter/src/components/FileUpload.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opus_submitter/src/components/FileUpload.vue b/opus_submitter/src/components/FileUpload.vue index b4a07a6..a66f25b 100644 --- a/opus_submitter/src/components/FileUpload.vue +++ b/opus_submitter/src/components/FileUpload.vue @@ -248,6 +248,8 @@ const isDragOver = ref(false); const error = ref(""); const files = ref([]); +const isProcessingOCR = ref(false); + // Watch for external changes to modelValue watch( () => props.modelValue, @@ -374,6 +376,12 @@ const isOpusMagnumImage = (file: File): boolean => { }; const processOCR = async (submissionFile: SubmissionFile) => { + while (isProcessingOCR.value) { + console.log("OCR is already processing, waiting 500ms..."); + await new Promise((res) => setTimeout(res, 500)); + } + + isProcessingOCR.value = true; // Find the file in the reactive array to ensure proper reactivity const fileIndex = files.value.findIndex( (f) => f.file === submissionFile.file, @@ -412,6 +420,7 @@ const processOCR = async (submissionFile: SubmissionFile) => { } finally { files.value[fileIndex].ocrProcessing = false; } + isProcessingOCR.value = false; }; const retryOCR = (submissionFile: SubmissionFile) => {