From 5c8b5043e8b9e5ca2130926bada828eb702062e2 Mon Sep 17 00:00:00 2001 From: Sven Date: Sun, 12 Apr 2026 12:52:49 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20rename=20cachedUrl=20to=20avoid=20confli?= =?UTF-8?q?ct=20+=20AP=20parallelWorkers=205=E2=86=922?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit patch-ap-account-lookup-cache-fallback: upstream fork already declares `const cachedUrl` in GET /api/v1/accounts/:id (fix: ap actor cache commit), causing a SyntaxError on deploy. Renamed to `actorCacheUrl` and added an upstream-fix guard to skip gracefully when the upstream version is present. indiekit.config.mjs: reduce AP parallelWorkers from 5 to 2 to lower steady-state memory usage on the node jail. Co-Authored-By: Claude Sonnet 4.6 --- indiekit.config.mjs | 2 +- scripts/patch-ap-account-lookup-cache-fallback.mjs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/indiekit.config.mjs b/indiekit.config.mjs index 96358539..ac0d60a9 100644 --- a/indiekit.config.mjs +++ b/indiekit.config.mjs @@ -402,7 +402,7 @@ export default { activityRetentionDays: 90, storeRawActivities: false, redisUrl, - parallelWorkers: 5, + parallelWorkers: 2, actorType: "Person", logLevel: activityPubLogLevel, debugDashboard: activityPubDebugDashboard, diff --git a/scripts/patch-ap-account-lookup-cache-fallback.mjs b/scripts/patch-ap-account-lookup-cache-fallback.mjs index 66c35158..a451caf6 100644 --- a/scripts/patch-ap-account-lookup-cache-fallback.mjs +++ b/scripts/patch-ap-account-lookup-cache-fallback.mjs @@ -33,10 +33,10 @@ const OLD_SNIPPET = ` return res.status(404).json({ error: "Record not found" // ─── GET /api/v1/accounts/:id/statuses ──────────────────────────────────────`; const NEW_SNIPPET = ` // Check ap_actor_cache — populated by resolveRemoteAccount after search/lookup [patch] ap-account-lookup-cache-fallback - const cachedUrl = getActorUrlFromId(id) + const actorCacheUrl = getActorUrlFromId(id) || (collections.ap_actor_cache ? (await collections.ap_actor_cache.findOne({ _id: id }))?.actorUrl : null); - if (cachedUrl) { - const remoteAccount = await resolveRemoteAccount(cachedUrl, pluginOptions, baseUrl, collections); + if (actorCacheUrl) { + const remoteAccount = await resolveRemoteAccount(actorCacheUrl, pluginOptions, baseUrl, collections); if (remoteAccount) return res.json(remoteAccount); } @@ -73,6 +73,13 @@ for (const filePath of candidates) { continue; } + // Upstream may have already added a cachedUrl block in GET /api/v1/accounts/:id + // (e.g. fix: ap actor cache commit). If so, the functionality is already present — skip. + if (source.includes("const cachedUrl = getActorUrlFromId(id)")) { + console.log(`[postinstall] patch-ap-account-lookup-cache-fallback: already fixed upstream in ${filePath}`); + continue; + } + if (!source.includes(OLD_SNIPPET)) { console.warn( `[postinstall] patch-ap-account-lookup-cache-fallback: target snippet not found in ${filePath} — skipping`,