Skip to content

Smart relay backoff and refresh reliability fixes#13

Merged
barrydeen merged 1 commit intomainfrom
feature/relay-backoff-and-refresh-fixes
Feb 20, 2026
Merged

Smart relay backoff and refresh reliability fixes#13
barrydeen merged 1 commit intomainfrom
feature/relay-backoff-and-refresh-fixes

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • Connection attempt tracking: Each relay tracks connect() calls in a sliding 60s window. After 20 attempts, the relay enters a 5-minute cooldown. Successful connections reset the counter.
  • Fix duplicate WebSocket connections on refresh: refreshFeed() was calling reconnectAll() right after updateRelays() which already connects new relays, causing duplicate WebSocket handshakes for relays mid-connect. Removed the redundant call and added a webSocket != null guard in connect().
  • DM relays included in connected count: updateConnectedCount() was only counting persistent + ephemeral relays, missing DM relays entirely.
  • Count refreshed after reconnectAll(): Explicitly recalculates after cleanup to avoid stale values.
  • PullToRefreshBox: Native Material3 pull-to-refresh on the feed screen.
  • Adaptive feed time window: Scales the since filter based on follow count (7 days for ≤20 follows down to 30 min for 700+).

Test plan

  • Pull-to-refresh on feed — counter should accurately reflect all connected relays (persistent + DM + ephemeral)
  • Simulate a failing relay (bad URL) — verify it enters 5 min cooldown after repeated failures, visible in relay console
  • Manual reconnect from relay screen should clear backoff and reconnect immediately
  • Small follow list (<20) should show older posts; large list (700+) should show recent only

…ve feed window

- Track connection attempts per relay; auto-cooldown for 5 min after 20
  attempts in 60s. Successful connects reset the counter.
- Guard against duplicate WebSocket creation when connect() is called
  while a handshake is already in progress.
- Remove redundant reconnectAll() in refreshFeed() since updateRelays()
  already connects new relays, preventing a flood of duplicate connections.
- Include DM relays in connected count and refresh count after reconnectAll().
- Add PullToRefreshBox for native pull-to-refresh on the feed.
- Adaptive feed time window based on follow count (7 days for small lists
  down to 30 min for 700+ follows).
@barrydeen barrydeen merged commit 5a5825c into main Feb 20, 2026
@barrydeen barrydeen deleted the feature/relay-backoff-and-refresh-fixes branch March 4, 2026 01:28
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.

1 participant