A node switch waits for the slowest relay before it finishes
I maintainer di solito rispondono entro 1 giorno
@Catrya ci sta già lavorando.
Dal 21/10/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- backend, networking
Direzione di ricerca
Start with rust/src/api/orders.rs, especially refresh_subscriptions_for_active_node and refetch_active_node_orders; compare the book fetch flow with the existing nostr::first_answer::newest_answer capability-fetch fix. Trace restart_orders_subscription to confirm manual refresh uses the same path. Done when slow relays no longer delay switching or refresh, fast-relay orders are ingested, and capability fetching proceeds without waiting for the book refetch; add the described relay-double test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
A node switch (Settings → Mostro node) runs refresh_subscriptions_for_active_node (rust/src/api/orders.rs), awaited
by set_active_mostro_node. Among other things, it:
- clears the order book, the escrow mode, the bond policy and the fee;
- re-subscribes the node's filters;
- refetches the new node's book with
refetch_active_node_orders; - fetches the node's capabilities (
fetch_and_set_node_capabilities).
The node selector (mostro_node_selector.dart) waits for the whole call before it closes and says the node was switched.
Problem
refetch_active_node_orders makes two fetch_events calls, one for the pending book and one for the recent changes, one after the other, each with a 10 s timeout. fetch_events returns only once every relay has sent EOSE. So a single slow relay holds the switch until it answers, or for up to 10 s per fetch (20 s in total), even when every other relay answered at once. The capability fetch only starts after that, so the new node's escrow mode, bond policy and fee stay unknown for as long as the slowest relay takes.
Seen in a log on a switch to 00000235, with relay.shadowbip.com slow:
20:40:10 every relay but relay.shadowbip.com has answered both book queries
20:40:17 eose sub=35c2d571… relay=wss://relay.shadowbip.com (pending book)
20:40:18 eose sub=aec58186… relay=wss://relay.shadowbip.com (recent changes)
20:40:18 switched subscriptions to mostro=00000235…
The switch took about 8 s. A switch a few minutes earlier, with the same relay answering in under a second, took about 2 s. The requests were the same both times; only that relay's speed changed. The same happens on the manual book refresh (restart_orders_subscription), which calls the same function.
This is the mistake the startup path already fixed for the capability fetch (Kind 38385), which used to cost ten seconds the same way. That fix (nostr::first_answer::newest_answer) reads one replaceable event. The book is many events, so it needs its own approach.
Proposed change
- Do not hold the switch on the slowest relay. Options, to be decided in the PR:
- ingest the book as it arrives (
stream_events) and stop a short grace after the first relays send EOSE, instead of waiting for all of them; - run the two book fetches at the same time instead of one after the other;
- start the capability fetch without waiting for the book refetch.
- ingest the book as it arrives (
- Relays that answer late are not lost: the live subscription opened in step 2 keeps delivering the new node's events.
Out of scope
- What the relays are asked (filters, the 48 h window).
- The cold start path, which already subscribes the book before anything relay-bound (CLAUDE.md, "Nothing relay-bound may sit in front of
subscribe_orders()"). - Relays that reject a REQ because they hit their subscription limit.
Acceptance criteria
- With one relay that never answers, or answers after the timeout, a node switch finishes about as fast as with that relay removed.
- The new node's book still shows every order the fast relays hold.
- The capabilities of the new node do not wait for the book refetch.
- The manual book refresh gets the same behaviour.
Testing
- Unit test with a relay double that answers at once and one that never sends EOSE: the refetch returns within the grace, with the fast relay's events ingested.
- Manual: add a relay that holds REQs open (or a slow public one), switch nodes, and compare the time between the switch and
switched subscriptions to mostro=…in the log with and without it.
- Lingua principale
- Dart
- Stelle
- 11
- Fork
- 9
- Merge medio
- 2g 1h
- PR unite (30g)
- 16
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MostroP2P/app
-
documentation priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
area: ui bug priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
area: ui bug priority: high
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Bug: Button "Share logs" does nothingForse già presa @Luquitasjeffrey l’ha presa 8 giorni fa. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
area: rust-core bug priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MostroP2P/app
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
spotiflacapp/SpotiFLAC-Mobile#1047 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
invoiceninja/app#229 ·
-
Python example: list a model's scenes and their camerasForse già presa @rudraparmar76 l’ha presa oggi. Apertadocumentation good first issue python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
iamahsanmehmood/openskp#796 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Plural rendering: first matching part wins, but gen-l10n lets the last one win (=1 shadows one)Apertabug help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
crowdin/flutter-sdk#97 ·