Unverified Commit ea01649a authored by Joseph's avatar Joseph Committed by GitHub

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

parent 4e877c01
......@@ -58,7 +58,7 @@ export async function pipeReadable(
// will also ensure the read promise rejects and frees our resources.
if (!readerDone) {
readerDone = true
reader.cancel().catch(() => {})
if (!reader.closed) reader.cancel().catch(() => {})
}
}
writable.on('close', onClose)
......@@ -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) {
reader.cancel().catch(() => {})
if (!reader.closed) reader.cancel().catch(() => {})
}
// If the client hasn't disconnected yet, end the writable so that the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment