Skip to content

Commit ce2430b

Browse files
committed
refactor: job handling to use update_job for completion and failure states
1 parent 7c8e70f commit ce2430b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

backend/database/job_store_connector.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ def job_exists(self, job_id: str) -> bool:
8686
def set_job_completed(self, job_id: str, result_data: Dict[str, Any]) -> bool:
8787
"""Mark job as completed with result data."""
8888
result_data["status"] = "completed"
89-
return self.create_job(job_id, result_data)
89+
return self.update_job(job_id, result_data)
9090

9191
def set_job_failed(self, job_id: str, error: str) -> bool:
9292
"""Mark job as failed with error message."""
9393
error_data = {
94-
"job_id": job_id,
9594
"status": "failed",
9695
"error": error
9796
}
98-
return self.create_job(job_id, error_data)
97+
return self.update_job(job_id, error_data)

backend/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ async def upload(self, file: UploadFile = None):
163163
# Log upload details
164164
logger.info(f"[Upload] {job_id}: {file.filename} ({file_size} bytes, {file.content_type})")
165165

166+
# Create initial job entry in shared storage
167+
self.job_store.create_job(job_id, {
168+
"job_id": job_id,
169+
"filename": file.filename,
170+
"status": "processing",
171+
"size_bytes": file_size,
172+
"content_type": file.content_type
173+
})
174+
166175
# Spawn background processing (non-blocking - returns immediately)
167176
self.process_video.spawn(contents, file.filename, job_id)
168177

0 commit comments

Comments
 (0)