From fd7011aff5dd8ffde0fb10990da238f7baf9a814 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 1 Feb 2025 18:16:25 +0000 Subject: fix: Abort all IO when workers timeout instead of detaching. Fixes #742 --- apps/workers/videoWorker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apps/workers/videoWorker.ts') diff --git a/apps/workers/videoWorker.ts b/apps/workers/videoWorker.ts index 10f18454..32f16f97 100644 --- a/apps/workers/videoWorker.ts +++ b/apps/workers/videoWorker.ts @@ -104,7 +104,9 @@ async function runWorker(job: DequeuedJob) { `[VideoCrawler][${jobId}] Attempting to download a file from "${url}" to "${assetPath}" using the following arguments: "${ytDlpArguments}"`, ); - await execa("yt-dlp", ytDlpArguments); + await execa("yt-dlp", ytDlpArguments, { + cancelSignal: job.abortSignal, + }); const downloadPath = await findAssetFile(videoAssetId); if (!downloadPath) { logger.info( @@ -124,7 +126,6 @@ async function runWorker(job: DequeuedJob) { ); return; } - console.log(JSON.stringify(err)); logger.error( `[VideoCrawler][${jobId}] Failed to download a file from "${url}" to "${assetPath}"`, ); -- cgit v1.2.3-70-g09d2