Repository navigation
Flush a piped destination that buffers - #499
Merged
Merged
Conversation
Compression middleware holds everything back until it is told to flush, so behind Express's compression() the whole document arrived at the end. pipe() now calls the destination's flush() once per tick of writes, like React does, and returns the destination. A response that onShellError already ended is no longer destroyed when the render stream closes, which reset keep-alive connections.
🦋 Changeset detectedLatest commit: a52f799 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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.
Behind Express's
compression()middleware,renderToPipeableStreamdoesn't stream: compression buffers until it's told to flush, and nothing tells it, so the shell and every boundary arrive together when the render ends. React callsflush()on the destination when it has one.pipe()now does the same, once per tick of writes and after they reached the destination, and stops once the destination ended or was destroyed. Withcompression()the shell now arrives right away and each boundary when it resolves.Two smaller fixes in
pipe():onShellErroranswers with its own response, the destination is no longer destroyed after the fact. That reset the connection for the next keep-alive request.