A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: dangling assets created by changing crawling config
MohamedBassem940550b9d391
diff --git a/apps/workers/workers/crawlerWorker.ts b/apps/workers/workers/crawlerWorker.tsindex 68db6e92..deced504 100644--- a/apps/workers/workers/crawlerWorker.ts+++ b/apps/workers/workers/crawlerWorker.ts@@ -938,6 +938,7 @@ async function crawlAndParseUrl(};// TODO(important): Restrict the size of content to store+ const assetDeletionTasks: Promise<void>[] = [];await db.transaction(async (txn) => {await txn.update(bookmarkLinks)@@ -978,9 +979,11 @@ async function crawlAndParseUrl(},txn,);+ assetDeletionTasks.push(silentDeleteAsset(userId, oldScreenshotAssetId));}if (imageAssetInfo) {await updateAsset(oldImageAssetId, imageAssetInfo, txn);+ assetDeletionTasks.push(silentDeleteAsset(userId, oldImageAssetId));}if (htmlContentAssetInfo.result === "stored") {await updateAsset(@@ -996,18 +999,16 @@ async function crawlAndParseUrl(},txn,);+ assetDeletionTasks.push(silentDeleteAsset(userId, oldContentAssetId));} else if (oldContentAssetId) {// Unlink the old content assetawait txn.delete(assets).where(eq(assets.id, oldContentAssetId));+ assetDeletionTasks.push(silentDeleteAsset(userId, oldContentAssetId));}});// Delete the old assets if any- await Promise.all([- silentDeleteAsset(userId, oldScreenshotAssetId),- silentDeleteAsset(userId, oldImageAssetId),- silentDeleteAsset(userId, oldContentAssetId),- ]);+ await Promise.all(assetDeletionTasks);return async () => {if (