fix: honor node streaming backpressure#8557
Merged
Conversation
🦋 Changeset detectedLatest commit: 8732ef8 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
e868a54 to
7b2f0b4
Compare
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
7b2f0b4 to
bc527bb
Compare
bc527bb to
3755593
Compare
wmertens
reviewed
Apr 19, 2026
wmertens
approved these changes
Apr 19, 2026
Member
wmertens
left a comment
There was a problem hiding this comment.
LGTM! But I'd like to see the comment?
|
|
||
| const writePromise = writer.write(new Uint8Array([1, 2, 3])); | ||
| await Promise.resolve(); | ||
| expect(res.listenerCount('drain')).toBe(0); |
Member
There was a problem hiding this comment.
could you add a comment explaining when the drain listeners are attached?
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.
This PR makes Qwik SSR honor downstream backpressure during Node streaming. The core renderer now waits for pending async flushes before emitting the next chunk, and the Node middleware translates ServerResponse.write() / drain semantics into an awaitable stream signal instead of fire-and-forget writes.
It also adds a regression test in render-api.spec.tsx to ensure a second chunk is not emitted while the first async write is still pending, plus Node middleware regression coverage so handled errors are not rethrown after headers were already sent.
Performance testing shows time drops from ~250ms to ~40ms for response