Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: Invoke cancel, only if the stream is not closed (#55684)" #55764

Merged
merged 1 commit into from Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/next/src/server/pipe-readable.ts
Expand Up @@ -58,7 +58,7 @@ export async function pipeReadable(
// will also ensure the read promise rejects and frees our resources.
if (!readerDone) {
readerDone = true
if (!reader.closed) reader.cancel().catch(() => {})
reader.cancel().catch(() => {})
}
}
writable.on('close', onClose)
Expand Down Expand Up @@ -88,7 +88,7 @@ export async function pipeReadable(
// If we broke out of the loop because of a client disconnect, and the
// close event hasn't yet fired, we can early cancel.
if (!readerDone) {
if (!reader.closed) reader.cancel().catch(() => {})
reader.cancel().catch(() => {})
}

// If the client hasn't disconnected yet, end the writable so that the
Expand Down