fix(nostr): prevent count timeouts from disconnecting relays

Prevents "count-timeout" errors from tripping the global circuit breaker in NostrClient. This ensures that slow auxiliary requests do not block critical subscription connections, resolving login issues in unstable network environments.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-02 20:29:25 +00:00
1 parent 725db3723c
commit ec77f50744
2 files changed
+69 -3

No files matched your search

+12 -3
View File
@@ -8608,9 +8608,18 @@ export class NostrClient {
this.countUnsupportedRelays.add(url);
} else {
logRelayCountFailure(url, error);
this.markRelayUnreachable(url, 60000, {
reason: isTimeout ? "count-timeout" : "count-error",
});
// If the count request timed out, we don't want to kill the entire relay connection
// because it might still be good for subscriptions.
// We only trip the circuit breaker for hard errors.
if (!isTimeout) {
this.markRelayUnreachable(url, 60000, {
reason: "count-error",
});
} else if (isDevMode) {
devLogger.warn(
`[nostr] Relay ${url} count timed out (ignored for circuit breaker).`
);
}
}
return {
url,