diff --git a/app/srv/api/prod.ts b/app/srv/api/prod.ts index 7f18dbe0..54dcc493 100644 --- a/app/srv/api/prod.ts +++ b/app/srv/api/prod.ts @@ -91,53 +91,6 @@ export const _ = { try { let file = Bun.file(build_path); - const ts = file.lastModified; - if ( - g.code_index_cache && - g.code_index_cache[site_id] && - g.code_index_cache[site_id][build_path] && - g.code_index_cache[site_id][build_path].content && - g.code_index_cache[site_id][build_path] && - g.code_index_cache[site_id][build_path].ts === ts && - req.headers.get("accept-encoding")?.includes("br") - ) { - return new Response( - g.code_index_cache[site_id][build_path].content, - { - headers: { - "content-encoding": "br", - "content-type": - g.code_index_cache[site_id][build_path].type, - }, - } - ); - } - - if (!g.code_index_cache) g.code_index_cache = {}; - if (!g.code_index_cache[site_id]) g.code_index_cache[site_id] = {}; - if (!g.code_index_cache[site_id][build_path]) { - if (!g.code_index_compressing) - g.code_index_compressing = new Set(); - - const key = `${site_id}-${build_path}`; - if (!g.code_index_compressing.has(key)) { - g.code_index_compressing.add(key); - setTimeout(async () => { - if (!g.br) { - g.br = await brotliPromise; - } - g.code_index_cache[site_id][build_path] = { - ts, - content: g.br.compress( - new Uint8Array(await file.arrayBuffer()) - ), - type: mime.getType(build_path) || "", - }; - g.code_index_compressing.delete(key); - }, 100); - } - } - return new Response( await gzipAsync(new Uint8Array(await file.arrayBuffer())), { diff --git a/pkgs/core/utils/global.ts b/pkgs/core/utils/global.ts index fc9c57c7..0ffd6595 100644 --- a/pkgs/core/utils/global.ts +++ b/pkgs/core/utils/global.ts @@ -64,11 +64,6 @@ export const g = global as unknown as { static_cache: any; route_cache_compressing: Set; route_cache: Record; - code_index_compressing: Set; - code_index_cache: Record< - string, - Record - >; main_cache: Record; br: BrotliWasmType; };