mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-10 06:43:00 +00:00
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:
1 parent
725db3723c
commit
ec77f50744
2 files changed
+69
-3
No files matched your search
+12
-3
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user