Boot-DM publish fails on startup — wait for a connected relay instead of a fixed sleep #48

Closed
opened 2026-06-27 10:02:41 +00:00 by padreug · 0 comments
Owner

On the aio-demo deploy of the nostr-tools build (#45), the boot-time admin DM failed at startup:

Error: publish failed on all relays after 5 attempts: relay not connected:
  wss://blastr.f7z.xyz; wss://nostr.mutinywallet.com
  at RelayPool.publish … at dmUser … at AdminInterface.notifyAdminsOfNewConnection

notifyAdminsOfNewConnection spins up a throwaway RelayPool to two external public relays, waits a fixed 2500ms, then publishes the DM. Those relays are often slow to connect, so the fixed wait (+ the ~1.2s publish retry budget) can elapse before any connection is up → the publish fails.

Non-critical: it's caught and logged by dmUser; the daemon reaches "ready to serve" before this and runs fine. But it's a noisy error on every boot when notifyAdminsOnBoot is set.

Fix: poll pool.connectedCount() > 0 up to a cap (~8s) before publishing, instead of the fixed sleep — succeed as soon as a relay is up, still best-effort (fall through + log if none connect). Small isolated change in admin/index.ts.

Refs: #45 (where the DM was ported to nostr-tools), #44.

On the `aio-demo` deploy of the nostr-tools build (#45), the boot-time admin DM failed at startup: ``` Error: publish failed on all relays after 5 attempts: relay not connected: wss://blastr.f7z.xyz; wss://nostr.mutinywallet.com at RelayPool.publish … at dmUser … at AdminInterface.notifyAdminsOfNewConnection ``` `notifyAdminsOfNewConnection` spins up a throwaway `RelayPool` to two **external** public relays, waits a fixed `2500ms`, then publishes the DM. Those relays are often slow to connect, so the fixed wait (+ the ~1.2s publish retry budget) can elapse before any connection is up → the publish fails. **Non-critical:** it's caught and logged by `dmUser`; the daemon reaches "ready to serve" before this and runs fine. But it's a noisy error on every boot when `notifyAdminsOnBoot` is set. **Fix:** poll `pool.connectedCount() > 0` up to a cap (~8s) before publishing, instead of the fixed sleep — succeed as soon as a relay is up, still best-effort (fall through + log if none connect). Small isolated change in `admin/index.ts`. Refs: #45 (where the DM was ported to nostr-tools), #44.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/nsecbunkerd#48
No description provided.