Firehose phase 4: active relay-health prober (unfreezes /relays)#16
Merged
Conversation
Refreshes the relays directory the /relays page renders (currently a frozen 2025-11 snapshot). Active, kind-less — not a hose. - src/prober.js: dials every relay in the directory (Node global WebSocket) for online/responseTime, fetches the NIP-11 info doc (global fetch) for requiresAuth/requiresPayment, and rolls up uptime via an aggregation- pipeline updateOne so uptime = checksOnline/checksTotal*100 stays consistent with the $inc'd totals. Self-schedules (PROBE_INTERVAL, default 1h); --once / RUN_ONCE for a single sweep. Concurrency + timeout env/CLI configurable. Relay universe = the relays collection, self-fed by the hose URL harvesting. No new deps. - probe.js: pm2/standalone entry (mirrors serve.js); npm run probe. - .env.example + README: document the prober. - test/prober.test.js: pure helpers (config/flags, nip11Flags, relayInfoUrl). Smoke (2 real sweeps): uptime rollup correct, NIP-11 detected a paid relay, offline relays handled, lastChecked set. npm test 55/55. Closes #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15. Phase 4 — the active relay-health prober that refreshes the
relaysdirectory the/relayspage renders (currently a frozen 2025-11 snapshot). It's active (dials each relay) and kind-less, so it's not a hose — a self-scheduling module of its own.What
src/prober.js:wsdep) →online,responseTime,lastError.Accept: application/nostr+json(globalfetch) →requiresAuth/requiresPaymentfromlimitation.updateOne$incschecksTotal/checksOnlinethen setsuptime = checksOnline/checksTotal*100from the fresh totals — andlastCheckedvia$$NOW. Doesn't clobber unrelated fields (e.g.acceptsEvents).relayscollection itself, continuously self-fed by the phase 2/3 hose harvesting.PROBE_INTERVAL, default 1h);--once/RUN_ONCEfor a single sweep.PROBE_CONCURRENCY(25),PROBE_TIMEOUT(7s) env/CLI-configurable. Bounded-concurrency sweep.probe.js: pm2/standalone entry (mirrorsserve.js);npm run probe.Verification
npm test— 55/55 (new pure-helper tests: arg parsing,proberConfigenv+flag precedence,relayInfoUrl,nip11Flags).node probe.js --helpprints usage without connecting to Mongo.checks 1/2; a stable one → 100%,2/2);nostr.wine→requiresPayment: true);online:false, uptime 0,lastCheckedset; auth/payment left untouched.Out of scope
Publish-test (
acceptsEvents) — a later pass · deploy + cut-over on nostr.social — phase 5 (would runprobe.jsunder pm2 alongside the indexer).