Skip to content

Re-attach relay OK/EOSE handlers after Nostr client is rebuilt on network switch - #981

Merged
dangershony merged 3 commits into
mainfrom
fix/nostr-client-rebind-after-network-switch
Oct 14, 2026
Merged

dangershony merged 3 commits into
mainfrom
fix/nostr-client-rebind-after-network-switch

Conversation

@dangershony

@dangershony dangershony commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #980

Switching network calls CloseClientConnection(), which disposes the Nostr multi-relay client. RelaySubscriptionsHandling only attached its OK/EOSE handlers in its constructor, so after a switch nothing listened to the new client. Deploying a project then failed with 'Nostr profile creation timed out after 30s' until the app was restarted. Relays were healthy; the app just never observed their OK/EOSE responses.

  • NostrCommunicationFactory raises ClientRecreated when it builds the main or discovery client
  • RelaySubscriptionsHandling re-attaches OK/EOSE handlers on that event
  • CloseClientConnection also disposes the discovery client and clears OK tracking

Not yet covered by an automated test. Manual check: switch network in Settings, then deploy a project without restarting.

Implements a manual-picker response to issue #971 without automatic
fallback: when the currently selected primary indexer fails to respond
to a request, MempoolSpaceIndexerApi now calls
INetworkService.NotifyIndexerUnreachable, which marks the indexer
offline and raises an IndexerUnreachable event (debounced per indexer
to avoid flooding subscribers from concurrent failing requests).

In src/design/App, ShellViewModel subscribes to this event and shows
a new IndexerUnreachableModal directly (no background retry loop),
letting the user pick a different configured indexer or add a custom
URL. Selecting an indexer just sets it as primary and persists it -
no automatic verification/fallback chain is attempted.
@dangershony

Copy link
Copy Markdown
Member Author

#980

@dangershony
dangershony merged commit 32e9d87 into main Oct 14, 2026
3 checks passed
@dangershony
dangershony deleted the fix/nostr-client-rebind-after-network-switch branch October 14, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relay connections can end up in a stale state where no relay acknowledges EVENT publishes, causing project creation to time out — app restart fixes it

1 participant