From dcfe331161a271dc20479b610788b70f7bde3233 Mon Sep 17 00:00:00 2001 From: riz Date: Thu, 20 Nov 2025 01:00:17 +0000 Subject: [PATCH] Make Brotli compression background to prevent blocking server startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Start compression asynchronously after 1 second delay - Server can start immediately while compression happens in background - Fixes slow site loading due to synchronous compression of 500+ files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pkgs/utils/deploy.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/utils/deploy.ts b/pkgs/utils/deploy.ts index a8f0913..c74405a 100644 --- a/pkgs/utils/deploy.ts +++ b/pkgs/utils/deploy.ts @@ -102,8 +102,12 @@ export const deploy = { }; if (g.deploy.content) { - startBrCompress(); - console.log(`[DEBUG] Compression started`); + // Start compression in background to avoid blocking server startup + setTimeout(() => { + console.log(`[DEBUG] Starting background Brotli compression...`); + startBrCompress(); + }, 1000); + console.log(`[DEBUG] Compression scheduled for background`); if (exists(dir("public"))) { await removeAsync(dir("public"));