fix: remove dead DB UPDATE calls in conform worker
The jobs table row no longer exists for conform jobs (POST /jobs/conform now goes directly to BullMQ). The UPDATE queries were no-ops (WHERE id = NULL) so they're safe to remove. BullMQ tracks completed/failed status itself.
This commit is contained in:
parent
e895a2f2df
commit
7260b188c5
1 changed files with 11 additions and 18 deletions
|
|
@ -9,13 +9,14 @@ import { parseEDL } from '../edl/parser.js';
|
|||
const S3_BUCKET = process.env.S3_BUCKET || 'wild-dragon';
|
||||
|
||||
export const conformWorker = async (job) => {
|
||||
const { jobId, edl, projectId, outputFormat } = job.data;
|
||||
const { edl, projectId, outputFormat } = job.data;
|
||||
const jobId = job.id;
|
||||
|
||||
const tmpDir = tmpdir();
|
||||
const edlPath = join(tmpDir, `edl-${job.id}.edl`);
|
||||
const segmentsDir = join(tmpDir, `segments-${job.id}`);
|
||||
const segmentListPath = join(tmpDir, `segments-${job.id}.txt`);
|
||||
const outputPath = join(tmpDir, `output-${job.id}.${outputFormat || 'mov'}`);
|
||||
const edlPath = join(tmpDir, `edl-${jobId}.edl`);
|
||||
const segmentsDir = join(tmpDir, `segments-${jobId}`);
|
||||
const segmentListPath = join(tmpDir, `segments-${jobId}.txt`);
|
||||
const outputPath = join(tmpDir, `output-${jobId}.${outputFormat || 'mov'}`);
|
||||
|
||||
try {
|
||||
// Write EDL to temp file
|
||||
|
|
@ -47,7 +48,7 @@ export const conformWorker = async (job) => {
|
|||
throw new Error(`Asset not found for reel: ${edit.reelName}`);
|
||||
}
|
||||
|
||||
const { id: assetId, original_s3_key: sourceKey } = assetRes.rows[0];
|
||||
const { original_s3_key: sourceKey } = assetRes.rows[0];
|
||||
const segmentInputPath = join(segmentsDir, `segment-${edit.editNumber}-src`);
|
||||
const segmentOutputPath = join(segmentsDir, `segment-${edit.editNumber}.mov`);
|
||||
|
||||
|
|
@ -84,23 +85,15 @@ export const conformWorker = async (job) => {
|
|||
console.log(`[conform] Uploading output to ${outputKey}`);
|
||||
await uploadToS3(S3_BUCKET, outputKey, outputPath);
|
||||
|
||||
// Mark job complete
|
||||
await job.updateProgress(95);
|
||||
await query(
|
||||
`UPDATE jobs SET status = 'complete', result = $1, updated_at = NOW() WHERE id = $2`,
|
||||
[JSON.stringify({ output_key: outputKey }), jobId]
|
||||
);
|
||||
|
||||
await job.updateProgress(100);
|
||||
console.log(`[conform] Job ${jobId} complete`);
|
||||
console.log(`[conform] Job ${jobId} complete → ${outputKey}`);
|
||||
|
||||
// Return value is stored by BullMQ and visible via GET /api/v1/jobs/:id
|
||||
return { jobId, outputKey };
|
||||
|
||||
} catch (error) {
|
||||
console.error(`[conform] Error in job ${jobId}:`, error);
|
||||
await query(
|
||||
`UPDATE jobs SET status = 'failed', error = $1, updated_at = NOW() WHERE id = $2`,
|
||||
[error.message, jobId]
|
||||
);
|
||||
// BullMQ marks the job failed automatically when we throw
|
||||
throw error;
|
||||
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in a new issue