Skip to content

Flush compressed server-sent events after writes - #7390

Open
bsobel-cf wants to merge 2 commits into
mainfrom
bsobel/EW-11074-flush-compressed-sse
Open

bsobel-cf wants to merge 2 commits into
mainfrom
bsobel/EW-11074-flush-compressed-sse

Conversation

@bsobel-cf

Copy link
Copy Markdown

Summary

Compressed text/event-stream responses can remain buffered inside gzip or Brotli encoders after an application writes a complete event, preventing clients from decoding that event until more output arrives or the response ends.

Flush gzip and Brotli encoders after each successful write for compressed Server-Sent Event bodies. Identity-encoded Server-Sent Events retain their existing behavior, and compressed non-SSE responses retain normal buffering. Flush failures propagate through the write operation.

Testing

  • system-streams-test, five runs
  • deferred-proxy-flow-test, five runs
  • server-test, five runs
  • Full-debug x64 ASAN system-streams-test, five uncached runs

Flush gzip and Brotli response compressors after each successful write
for text/event-stream bodies. This lets clients decode complete events
before the response ends while retaining normal buffering for other
compressed responses.

Cover codec behavior, failure propagation, deferred proxy execution,
and end-to-end response delivery.
@bsobel-cf
bsobel-cf requested review from a team as code owners September 16, 2026 17:03
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@bsobel-cf

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Sep 16, 2026
@bsobel-cf bsobel-cf self-assigned this Sep 16, 2026
@ask-bonk

ask-bonk Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

@bsobel-cf Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@jasnell
jasnell self-requested a review September 17, 2026 02:44
Comment on lines +191 to +193
auto promise = compressor.write(buffer);
return flushAfterWrite ? promise.then([this]() { return compressor.flush(); })
: kj::mv(promise);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this could be a coroutine to prevent the this capture in the lambda.

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