You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: base provider state on CDN fetches only, not SSE connection state - #44
Simplifies SSE, as described here, and update e2e accordingly.
TLDR: if SSE is connected, we poll slow - if SSE is not connected, we poll fast, regardless of the SSE connection being disabled by config or disconnect by accident; only failed polls impact provider state
The reason will be displayed to describe this comment to others. Learn more.
Still trying to understand the exact flow of the sse connection within the providers, I found 2 spots where we are somewhat 'loosing' conditions with the code removal. I'm not confident that they are really issues, but might be worth looking at again :)
The reason will be displayed to describe this comment to others. Learn more.
[q] removing this part, will result in an immediate stale state if onFetchFailure is called, right? So, we are much more sensitive to issues of the CDN than we were before, when additionally checking for a healthy sse. We do have the http retry, however, calculating 120ms for MAX_TOTAL_BACKOFF_MS and MAX_ATTEMPTS being 2, the cdn cannot have a very long hiccup.
In your experience is this something we should give more time with by increasing the max retries or adding some grace time?
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
I think we can fix this with one small addition to my simplification: after a failed fetch, poll at 10s until a fetch succeeds... so pollingManager.setInterval(pollIntervalDisconnected) on failure, and restoring pollIntervalConnected on success if SSE is connected.
So whether SSE is connected or not, a failed fetch drops us to the fast cadence. If it's a blip, we recover within ~10s and don't go to a spurious ERROR over. I'm OK with quick STALE transitions; those are just being truthful, and even our internal provider does this due to gRPC stream timeouts.
I'd rather not add more retries per fetch (a fetch has to stay under the 10s poll interval) or more grace time (it would only delay a correct signal).
Overall, the simplification is still much better, it avoids the entire debounce construct and multiple paths for STALE/ERROR - we just leverage an existing construct (poll aggressiveness) to fix your finding.
The new test in the test harness PR failed until I made the fix I proposed above.
Again, nice find! Let me know if you think this covers it.
The reason will be displayed to describe this comment to others. Learn more.
[q] similar to the other comment: we loose the (!wasConnected) condition for this catch up fetch. What if there is a short sse hiccup, it reconnects immediately, then it will send this fetch unnecessarily, right, because we dont check anymore?
This PR makes provider staleness depend on CDN fetch outcomes rather than SSE connection state, while retaining SSE-based polling intervals and reconnect catch-up fetches.
Changes:
Removes SSE disconnect debouncing and disconnect-driven state transitions.
Accelerates polling after CDN failures and restores the connected interval after successful fetches.
Updates unit tests and end-to-end steps for the revised behavior.
If an SSE catch-up fetch fails after pollingManager.start() but before initialization adopts the connected cadence (lines 337–340), that handoff can overwrite this fast interval even though the provider is now STALE. Recovery then waits for the 10-minute connected interval, beyond the grace period. Synchronize the initialization handoff with these callbacks and select the connected interval only while READY.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
There are no active review issues for the changes to CDN-driven staleness and SSE-controlled polling.
No open issues 🎉
Review effort: Balanced
toddbaert
changed the title
feat: base staleness on CDN fetches only, not SSE state
feat: base provider state on CDN fetches only, not SSE connection state
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simplifies SSE, as described here, and update e2e accordingly.
TLDR: if SSE is connected, we poll slow - if SSE is not connected, we poll fast, regardless of the SSE connection being disabled by config or disconnect by accident; only failed polls impact provider state
Related: