Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
ea01649a
Unverified
Commit
ea01649a
authored
Sep 21, 2023
by
Joseph
Committed by
GitHub
Sep 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Invoke cancel, only if the stream is not closed (#55684)
parent
4e877c01
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
pipe-readable.ts
packages/next/src/server/pipe-readable.ts
+2
-2
No files found.
packages/next/src/server/pipe-readable.ts
View file @
ea01649a
...
@@ -58,7 +58,7 @@ export async function pipeReadable(
...
@@ -58,7 +58,7 @@ export async function pipeReadable(
// will also ensure the read promise rejects and frees our resources.
// will also ensure the read promise rejects and frees our resources.
if
(
!
readerDone
)
{
if
(
!
readerDone
)
{
readerDone
=
true
readerDone
=
true
reader
.
cancel
().
catch
(()
=>
{})
if
(
!
reader
.
closed
)
reader
.
cancel
().
catch
(()
=>
{})
}
}
}
}
writable
.
on
(
'close'
,
onClose
)
writable
.
on
(
'close'
,
onClose
)
...
@@ -88,7 +88,7 @@ export async function pipeReadable(
...
@@ -88,7 +88,7 @@ export async function pipeReadable(
// If we broke out of the loop because of a client disconnect, and the
// If we broke out of the loop because of a client disconnect, and the
// close event hasn't yet fired, we can early cancel.
// close event hasn't yet fired, we can early cancel.
if
(
!
readerDone
)
{
if
(
!
readerDone
)
{
reader
.
cancel
().
catch
(()
=>
{})
if
(
!
reader
.
closed
)
reader
.
cancel
().
catch
(()
=>
{})
}
}
// If the client hasn't disconnected yet, end the writable so that the
// If the client hasn't disconnected yet, end the writable so that the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment