Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

feat(mobile): switch to using context menu in ios (#3002)

Mohamed Bassemf57aad1d8629
diff --git a/apps/workers/workers/crawler/assetStorage.ts b/apps/workers/workers/crawler/assetStorage.ts
index 2f3bc696..2067fae9 100644
--- a/apps/workers/workers/crawler/assetStorage.ts
+++ b/apps/workers/workers/crawler/assetStorage.ts
@@ -327,6 +327,10 @@ export async function downloadAndStoreFile(
logger.error(
`[Crawler][${jobId}] Failed to download and store ${fileType}: ${e}`,
);
+ // A crawler timeout aborts the job-wide signal. Do not turn that abort
+ // into a best-effort download miss: the queue runner must observe it so
+ // the crawl is retried and is not reported as successfully completed.
+ abortSignal.throwIfAborted();
return null;
} finally {
if (assetPath) {
diff --git a/apps/workers/workers/crawler/crawlAndParse.ts b/apps/workers/workers/crawler/crawlAndParse.ts
index b6ef593a..5b63849c 100644
--- a/apps/workers/workers/crawler/crawlAndParse.ts
+++ b/apps/workers/workers/crawler/crawlAndParse.ts
@@ -97,7 +97,12 @@ export async function handleAsAssetBookmark(
runProxy,
);
if (!downloaded) {
- return;
+ // Unlike screenshots and banner images, this download is the crawl's
+ // primary result. Without it the bookmark cannot be converted to an
+ // asset and none of the preprocessing/inference jobs can run.
+ throw new Error(
+ `[Crawler][${jobId}] Failed to download required ${assetType} asset`,
+ );
}
const fileName = path.basename(new URL(url).pathname);
await db.transaction(async (trx) => {
diff --git a/apps/workers/workers/crawlerWorker.ts b/apps/workers/workers/crawlerWorker.ts
index 0d3f834e..2c576f0e 100644
--- a/apps/workers/workers/crawlerWorker.ts
+++ b/apps/workers/workers/crawlerWorker.ts
@@ -346,6 +346,11 @@ async function runCrawler(
}
const { bookmarkId, archiveFullPage, storePdf } = request.data;
+ // Add the bookmark id before any database or network work so failed and
+ // aborted crawler events remain discoverable by bookmark id.
+ addLogFields<"crawlerWorker.run">({
+ "bookmark.id": bookmarkId,
+ });
const {
url,
userId,
@@ -366,6 +371,7 @@ async function runCrawler(
const runProxy = selectRunProxies();
addLogFields<"crawlerWorker.run">({
+ "user.id": userId,
"crawler.url": url,
"crawler.domain": getBookmarkDomain(url),
"crawler.proxy": redactUrlCredentials(