Checkpoint: note publish latency trim

This commit is contained in:
Avi 2026-08-24 00:04:01 -05:00
commit 8f637618bc

View file

@ -1,4 +1,94 @@
# Checkpoint — NIP-05 identifiers (2026-08-23) # Checkpoint — Note publish latency trim (2026-08-24)
A stopping point you can return to if this session is closed. Everything below was
verified green at the moment this file was written.
## Where things are
- Project: `/home/avi/Projects/Nostr_Keynctr`
- Git repo: `master` @ `b001b3c` ("Trim note publish latency: skip global
connection wait, parallel sends, 6s cap"). Before it: `2ad054e` (checkpoint),
`045fa47` (NIP-05), `cb23a5e` (metadata latency trim), `4d70b25` (concurrent IPC).
- Working tree is **clean** apart from this checkpoint update, which is committed right after.
## What was completed
1. **Diagnosed a slow/failing publish (2026-08-24, `b001b3c`).** User reported a
10+ s note publish with two relay failures (`relay.snort.social` "Not
connected", `relay.nostr.band` "did not respond in time"). Live probing of the
user's relays showed:
- The note itself **did land** on nos.lol, nostr.l484.com, relay.primal.net,
soloco.nl (why phoenix.social showed it). Kind-0 metadata ("Boo" + photo)
is on those relays too — Primal/Iris visibility is third-party indexing lag
or their differing relay sets, not lost data.
- `wss://relay.damus.io` is **down** (HTTP 503) and `wss://relay.nostr.band`
**times out on the WebSocket handshake** right now.
- Root cause of the stall: the *note* path still had the pattern removed from
the metadata path in `cb23a5e` — a global `wait_for_connection(10s)` that
burned its full timeout whenever any single relay was unreachable, then
sequential per-relay sends (15s timeout each).
2. **Fix (`b001b3c`)** — `src/publish.rs` now mirrors `src/profiles.rs`:
- No global connection wait (`send_event` waits for each relay's writable
state itself).
- Sends run in parallel via `tokio::task::JoinSet`; per-relay timeout cut
15s → 6s, so worst case ≈ 6 s regardless of how many relays are dead.
- Failure reporting unchanged (per-relay concise error + technical detail).
## Commits added most recently
- `b001b3c` Trim note publish latency: skip global connection wait, parallel sends, 6s cap
## Verification commands run (all green)
Rust (repo root):
```
cargo test # 102 passed; 0 failed
cargo clippy --all-targets # only pre-existing warnings in src/profiles.rs
cargo fmt --check # clean
cargo build --release # success
```
Frontend (`frontend/`) — untouched by this change but re-run:
```
npm test # 14 files, 84 tests passed
npm run typecheck # clean
npm run lint # 0 errors
npm run format:check # clean
npm run build # vite build success
npm run electron:build # tsc electron main success
```
## How to use / reproduce
GUI: `cd ~/Projects/Nostr_Keynctr/frontend && npm start`, compose a note,
publish. Expect ~1–6 s even when some relays are dead; failures are listed
per-relay under the composer.
CLI:
```bash
B=~/Projects/Nostr_Keynctr/target/release/keynectr
$B publish "hello" # text note as active profile
```
## Notes & next steps
- **Relay health (checked 2026-08-24):** damus.io returning 503; nostr.band WS
handshake times out. Consider disabling nostr.band until it recovers, and
adding healthy high-traffic relays (e.g. offchain.pub, nostr.mom) so clients
whose default sets don't include nos.lol/primal.net can see your notes.
- Profile/photo on Primal: metadata + notes are on relay.primal.net; if Primal
still shows nothing later, re-check via primal.net (their crawler indexes with
delay). Iris/Yakihonne need the note on relays *they* read.
- Pre-existing clippy warnings in `src/profiles.rs` remain (drop of reference,
unused `delete_profile`).
- Candidate next features: banner/about fields in the edit UI.
---
# Older checkpoint — NIP-05 identifiers (2026-08-23)
A stopping point you can return to if this session is closed. Everything below was A stopping point you can return to if this session is closed. Everything below was
verified green at the moment this file was written. verified green at the moment this file was written.