diff --git a/services/worker/src/workers/conform.js b/services/worker/src/workers/conform.js index c9cf93b..84194e4 100644 --- a/services/worker/src/workers/conform.js +++ b/services/worker/src/workers/conform.js @@ -1,5 +1,5 @@ import { join } from 'path'; -import { unlink, writeFile, mkdir } from 'fs/promises'; +import { unlink, writeFile, mkdir, rm } from 'fs/promises'; import { tmpdir } from 'os'; import { query } from '../db/client.js'; import { downloadFromS3, uploadToS3 } from '../s3/client.js'; @@ -97,11 +97,12 @@ export const conformWorker = async (job) => { throw error; } finally { - // Best-effort cleanup of temp files + // Best-effort cleanup of all temp files and directories await Promise.all([ unlink(edlPath).catch(() => {}), unlink(segmentListPath).catch(() => {}), unlink(outputPath).catch(() => {}), + rm(segmentsDir, { recursive: true, force: true }).catch(() => {}), ]); } };