Skip to content

Commit

Permalink
fix: do not use tee() in caching bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed Aug 14, 2023
1 parent d677df1 commit a771b3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export class CachingBucket {
if (cacheRes && cacheRes.body) return { key, body: cacheRes.body, arrayBuffer: () => cacheRes.arrayBuffer() }
const obj = await this.#source.get(key)
if (!obj) return null
const [body0, body1] = obj.body.tee()
this.#ctx.waitUntil(this.#cache.put(cacheKey, new Response(body1, {
const bytes = new Uint8Array(await obj.arrayBuffer())
this.#ctx.waitUntil(this.#cache.put(cacheKey, new Response(bytes, {
headers: { 'Cache-Control': `max-age=${MAX_AGE}` }
})))
const res = new Response(body0)
const res = new Response(bytes)
return {
key,
get body () {
Expand Down

0 comments on commit a771b3f

Please sign in to comment.