Deleted User
03/09/2023, 1:19 AMkian
03/09/2023, 1:19 AMkian
03/09/2023, 1:20 AMDeleted User
03/09/2023, 1:20 AMkian
03/09/2023, 1:20 AMcf part of RequestInitdave
03/09/2023, 2:18 AM.tee() on a response cause extra memory to be used if one reader is slower than the other?dave
03/09/2023, 2:18 AMAriful
03/09/2023, 2:19 AMkian
03/09/2023, 2:20 AMkian
03/09/2023, 2:21 AMdave
03/09/2023, 2:22 AMkian
03/09/2023, 2:23 AMkian
03/09/2023, 2:23 AMkian
03/09/2023, 2:24 AMconst resp = await fetch(url); and then const [foo, bar] = resp.body.tee() and then ctx.waitUntil(env.R2.put(key, foo)) and return new Response(bar) - the response being streamed to the client must be completed in under 30 seconds, since waitUntil currently has a bug where it starts the 30 second timer when the response headers are sent to the client rather than after the response body has finished streaming.kian
03/09/2023, 2:24 AMwaitUntil operation will be cancelled.kian
03/09/2023, 2:25 AMdave
03/09/2023, 2:27 AMjavascript
const resp1 = await fetch(url)
const resp2 = await fetch(url)
ctx.waitUntil(env.R2.put(key, resp2.body))
return resp1kian
03/09/2023, 2:28 AMdave
03/09/2023, 2:29 AMjavascript
const resp1 = await fetch(url)
const resp2 = fetch(url).then(async (response) => { return response.body })
ctx.waitUntil(env.R2.put(key, resp2))
return resp1kian
03/09/2023, 2:30 AMkian
03/09/2023, 2:30 AMdave
03/09/2023, 2:31 AMjavascript
const resp1 = await fetch(url)
const my_promise = fetch(url).then(async (response) => { env.R2.put(key, response.body) })
ctx.waitUntil(my_promise)
return resp1dave
03/09/2023, 2:31 AMkian
03/09/2023, 2:31 AMkian
03/09/2023, 2:32 AMkian
03/09/2023, 2:33 AMdave
03/09/2023, 2:33 AMkian
03/09/2023, 2:33 AMdave
03/09/2023, 2:33 AM