aboutsummaryrefslogtreecommitdiffstats
path: root/feed/server.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-12-03 21:57:12 -0700
committerAdam Soltys <[email protected]>2026-12-03 21:57:12 -0700
commit8249966d6f55b06c6f7a6340693b068a89058327 (patch)
tree4c27a2726eba1fc08332959ea3dc55c197ee220f /feed/server.js
parentcede049f15c9bdcf3991656070c3067d8f152753 (diff)
downloadcoinosv3-8249966d6f55b06c6f7a6340693b068a89058327.tar.gz
coinosv3-8249966d6f55b06c6f7a6340693b068a89058327.zip
feed: every relay ask ends at its maxWait, and crawlers wait up to 7.5 s.HEADmaster
Measured after a restart: a link-preview crawler still got the plain page after 6 s, because nostr-tools starts maxWait only once a socket is open and a relay slow to connect held the build open. query() now stops at maxWait from the ask itself; a cold post page built for TelegramBot in 3.7 s (was over 6 s), a browser still gets its page at 0.65 s. BOT_BUDGET_MS 7.5 s covers a reply's three rounds (2.5 + 2.5 + 2 s); nginx on cs allows the note/profile routes 10 s (was 3 s, which cut crawlers short). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar (feed copy, same as coinosv3-server)
Diffstat (limited to 'feed/server.js')
-rw-r--r--feed/server.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/feed/server.js b/feed/server.js
index 9566447..cc97d8b 100644
--- a/feed/server.js
+++ b/feed/server.js
@@ -25,6 +25,9 @@ const query = (relays, filter, maxWait, { idle = 0 } = {}) => new Promise((resol
onclose: finish,
});
if (done) try { sub.close(); } catch {}
+ // maxWait starts only once a socket is open: a relay that's slow to connect
+ // (every socket is cold after a restart) held builds past 6 s. A hard stop.
+ setTimeout(finish, maxWait);
});
const threads = createThreadCache({ build: (ref) => buildThread(ref, query) });
const primal = createPrimal();