From a24755d92ce399beaf9575b75625c179e371b0c5 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 9 Nov 2024 14:04:16 +0000 Subject: [PATCH] fix: Remove old downloaded video when it gets refreshed --- apps/workers/videoWorker.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/workers/videoWorker.ts b/apps/workers/videoWorker.ts index 444448f7..518b41c5 100644 --- a/apps/workers/videoWorker.ts +++ b/apps/workers/videoWorker.ts @@ -11,6 +11,7 @@ import { getAssetSize, newAssetId, saveAssetFromFile, + silentDeleteAsset, } from "@hoarder/shared/assetdb"; import serverConfig from "@hoarder/shared/config"; import logger from "@hoarder/shared/logger"; @@ -152,6 +153,7 @@ async function runWorker(job: DequeuedJob) { txn, ); }); + await silentDeleteAsset(userId, oldVideoAssetId); logger.info( `[VideoCrawler][${jobId}] Finished downloading video from "${url}" and adding it to the database`,