Skip to content

Commit

Permalink
fix: fix the linux patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Feb 6, 2024
1 parent cf4d90d commit 65ff9e1
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lib/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,14 +1100,9 @@ function fetchFinale (fetchParams, response) {
const byteStream = new ReadableStream({
readableStream: transformStream.readable,
async pull (controller) {
// TODO(mcollina): removen this block, not sure why pull() is called twice
if (this.readableStream.locked) {
return
}

const reader = this.readableStream.getReader()

while (controller.desiredSize >= 0) {
while (controller.desiredSize > 0) {
const { done, value } = await reader.read()

if (done) {
Expand Down Expand Up @@ -1910,8 +1905,8 @@ async function httpNetworkFetch (

// 11. Let pullAlgorithm be an action that resumes the ongoing fetch
// if it is suspended.
const pullAlgorithm = () => {
fetchParams.controller.resume()
const pullAlgorithm = async () => {
await fetchParams.controller.resume()
}

// 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s
Expand Down Expand Up @@ -2026,9 +2021,7 @@ async function httpNetworkFetch (
// into stream.
const buffer = new Uint8Array(bytes)
if (buffer.byteLength) {
try {
fetchParams.controller.controller.enqueue(buffer)
} catch {}
fetchParams.controller.controller.enqueue(buffer)
}

// 8. If stream is errored, then terminate the ongoing fetch.
Expand Down

0 comments on commit 65ff9e1

Please sign in to comment.