Skip to content

fix(app): back off event stream reconnects after repeated failures - #48015

Open
CannonRS wants to merge 1 commit into
anomalyco:devfrom
mQorva:event-reconnect-backoff
Open

fix(app): back off event stream reconnects after repeated failures#48015
CannonRS wants to merge 1 commit into
anomalyco:devfrom
mQorva:event-reconnect-backoff

Conversation

@CannonRS

@CannonRS CannonRS commented Sep 8, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #48014

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The global event stream (server-sdk.tsx) reconnected after every failure with
the same fixed RECONNECT_DELAY_MS delay. This adds an exponential backoff:

  • a consecutiveErrors counter resets on every successfully consumed event and
    increments on each catch;
  • the reconnect wait becomes
    min(5000, RECONNECT_DELAY_MS * 1.5 ** min(consecutiveErrors, 8)),
    so repeated failures back off from 250 ms up to a 5 s cap, while a healthy
    stream keeps the fast cadence.

No other behaviour in the loop changes.

How did you verify your code works?

  • bun typecheck in packages/app: clean.
  • The change is a 5-line delta restricted to the reconnect wait; the counter is
    scoped to the loop invocation and reset on any received event, so a recovered
    stream returns to the fast path immediately.

Screenshots / recordings

N/A — not a UI change.

Fork

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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.

Global event stream reconnects on a fixed 250ms timer with no backoff

1 participant