A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: Cleanup temp assets on monolith timeout
Mohamed Bassem8dd84ef58b8d
diff --git a/apps/workers/workers/crawlerWorker.ts b/apps/workers/workers/crawlerWorker.tsindex baea1346..d8e75aba 100644--- a/apps/workers/workers/crawlerWorker.ts+++ b/apps/workers/workers/crawlerWorker.ts@@ -671,11 +671,27 @@ async function archiveWebpage(const assetId = newAssetId();const assetPath = `/tmp/${assetId}`;- await execa({+ let res = await execa({input: html,cancelSignal: abortSignal,})("monolith", ["-", "-Ije", "-t", "5", "-b", url, "-o", assetPath]);+ if (res.isCanceled) {+ logger.error(+ `[Crawler][${jobId}] Canceled archiving the page as we hit global timeout.`,+ );+ await tryCatch(fs.unlink(assetPath));+ return null;+ }++ if (res.exitCode !== 0) {+ logger.error(+ `[Crawler][${jobId}] Failed to archive the page as the command exited with code ${res.exitCode}`,+ );+ await tryCatch(fs.unlink(assetPath));+ return null;+ }+const contentType = "text/html";// Get file size and check quota before saving