Skip to content

fix(chat): improve event stream resilience and reduce churn#912

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/event-stream-resilience
Jun 16, 2026
Merged

fix(chat): improve event stream resilience and reduce churn#912
bmc08gt merged 1 commit into
code/cashfrom
fix/event-stream-resilience

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator
  • Guard openEventStream() to skip when already connected, preventing multiple callers (lifecycle, network, heartbeat) from tearing down a healthy stream
  • Replace fixed 5s retry with exponential backoff (2s→60s cap)
  • Switch from SharedFlow(DROP_OLDEST) to Channel(UNLIMITED) so no chat updates are silently dropped under load
  • Coalesce applyUpdate into a single _state.update{} per ChatUpdate instead of up to 4 separate emissions
  • Move syncFeed() side-effect out of state update lambda
  • Only sync feed on heartbeat when stream is disconnected

- Guard openEventStream() to skip when already connected, preventing
  multiple callers (lifecycle, network, heartbeat) from tearing down
  a healthy stream
- Replace fixed 5s retry with exponential backoff (2s→60s cap)
- Switch from SharedFlow(DROP_OLDEST) to Channel(UNLIMITED) so no
  chat updates are silently dropped under load
- Coalesce applyUpdate into a single _state.update{} per ChatUpdate
  instead of up to 4 separate emissions
- Move syncFeed() side-effect out of state update lambda
- Only sync feed on heartbeat when stream is disconnected

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt self-assigned this Jun 16, 2026
@github-actions github-actions Bot added area: network gRPC, connectivity, API, exchange rates type: fix Bug fix labels Jun 16, 2026
@bmc08gt bmc08gt merged commit f36e425 into code/cash Jun 16, 2026
3 checks passed
@bmc08gt bmc08gt deleted the fix/event-stream-resilience branch June 16, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant