diff --git a/ocr/app/routers/extract.py b/ocr/app/routers/extract.py index 45f657e..e9aa6e3 100644 --- a/ocr/app/routers/extract.py +++ b/ocr/app/routers/extract.py @@ -359,8 +359,8 @@ async def process_manual_job(job_id: str) -> None: # Update status to processing await job_queue.update_manual_job_progress(job_id, 5, "Starting extraction") - # Get job data - file_bytes = await job_queue.get_job_data(job_id) + # Get job data (must use manual-specific key prefix) + file_bytes = await job_queue.get_manual_job_data(job_id) if not file_bytes: await job_queue.fail_manual_job(job_id, "Job data not found") return diff --git a/ocr/app/services/job_queue.py b/ocr/app/services/job_queue.py index 5afce25..36f44fe 100644 --- a/ocr/app/services/job_queue.py +++ b/ocr/app/services/job_queue.py @@ -207,10 +207,15 @@ class JobQueue: async def get_job_data(self, job_id: str) -> Optional[bytes]: """Get the file data for a job.""" - r = await self.get_redis() - data_key = f"{JOB_DATA_PREFIX}{job_id}" + return await self._get_raw_data(f"{JOB_DATA_PREFIX}{job_id}") - # Get raw bytes (not decoded) + async def get_manual_job_data(self, job_id: str) -> Optional[bytes]: + """Get the file data for a manual extraction job.""" + return await self._get_raw_data(f"{MANUAL_JOB_DATA_PREFIX}{job_id}") + + async def _get_raw_data(self, data_key: str) -> Optional[bytes]: + """Get raw binary data from Redis.""" + # Need separate connection with decode_responses=False for binary data raw_redis = redis.Redis( host=settings.redis_host, port=settings.redis_port,