Skip to content

FIX: MessageBus reconnect reliability - #8

Merged
merefield merged 10 commits into
masterfrom
fix/messagebus-reconnect-reliability
Mar 19, 2026
Merged

FIX: MessageBus reconnect reliability#8
merefield merged 10 commits into
masterfrom
fix/messagebus-reconnect-reliability

Conversation

@merefield

@merefield merefield commented Mar 19, 2026

Copy link
Copy Markdown
Owner
  • Reworked live status updates to be MessageBus-first, with notification and PM badges seeded from Discourse’s notification_channel_position instead of relying on steady-state HTTP polling.
  • Replaced constant healthy-state badge polling with reconnect-triggered one-shot HTTP resync, while keeping HTTP fallback when live counts are still unseeded or MessageBus is unavailable.
  • Added per-channel MessageBus cursor tracking for /latest, /new, /unread, /unread/:user_id, /notification/:user_id, and active /topic/:id subscriptions.
  • Added a MessageBus watchdog that runs every 30s, detects stale clients after 240s without successful polls, and rebuilds the client cleanly.
  • Added reconnect recovery that restores subscriptions from saved channel positions and requests list/topic refreshes when resume state is not trustworthy.
  • Introduced a timeout-configured MessageBusHTTPClient wrapper with explicit open, read, and write timeouts.
  • Fixed reconnect edge cases so badge seeding keeps retrying until live values are populated, and default -1 cursors are treated as non-resumable rather than trusted.
  • Added live topic subscriptions for /topic/:id, so termcourse can react while you are inside a topic instead of only at the list level.
  • Added live in-topic handling for new posts, including tail-follow behavior when you are already on the last loaded post.
  • Added live in-topic handling for post edits, likes/unlikes, delete/recover-style updates via targeted single-post refreshes.
  • Added topic refresh fallback for reload-style and stats-style topic events when incremental updates are not sufficient.
  • Fixed topic reconnect behavior so revisiting a topic updates the stored topic cursor and failed topic refreshes stay pending until they succeed.
  • Improved topic-view responsiveness by removing constant idle rerenders, rendering only the needed visible post blocks, caching rendered post blocks, and reducing debug I/O churn.
  • Tightened temporary debug instrumentation so it is only active when TERMCOURSE_DEBUG=1.
  • Clarified auth behavior in the README: realtime MessageBus features require login auth with a session cookie; API-key auth is HTTP-only and does not support live PM/topic updates.
  • Added focused regression coverage for reconnect reliability, resumable cursors, topic refresh behavior, healthy-state no-poll behavior, and the custom MessageBus HTTP client wrapper.

Loading
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.

2 participants