fix: preserve SSE resume cache and correct event replay - #1165
Open
freedom-winds wants to merge 3 commits into
Open
Conversation
DaleSeo
reviewed
Aug 11, 2026
| for resource in channel.resources { | ||
| if close { | ||
| let resources: Vec<_> = request_wise.resources.drain().collect(); | ||
| request_wise.completed_at = Some(Instant::now()); |
Member
There was a problem hiding this comment.
The worker checks for eviction before it waits, so it checks this newly completed entry right away. That means the entry can outlive its TTL. If Resume is the next event, it gets served before the next eviction pass.
Comment on lines
+338
to
+345
| if index < front_event_id.index { | ||
| return Err(SessionError::InvalidEventId); | ||
| } | ||
| // Last-Event-ID is the last event the client received, so resume only | ||
| // with events that follow it. | ||
| let sync_index = index | ||
| .saturating_sub(front_event_id.index) | ||
| .saturating_add(1); |
Member
There was a problem hiding this comment.
If the retained cache starts at event N and the client last received N - 1, every missed event is still available, but this check rejects the resume.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix two issues in the Streamable HTTP server's SSE resume behavior:
Last-Event-IDwas replayed again.Changes
Last-Event-ID.completed_cache_ttlto evict completed request caches.