Make Brotli compression background to prevent blocking server startup

- 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 <noreply@anthropic.com>
This commit is contained in:
riz 2025-11-20 01:00:17 +00:00
parent 5000dfaa75
commit dcfe331161
1 changed files with 6 additions and 2 deletions

View File

@ -102,8 +102,12 @@ export const deploy = {
}; };
if (g.deploy.content) { if (g.deploy.content) {
startBrCompress(); // Start compression in background to avoid blocking server startup
console.log(`[DEBUG] Compression started`); setTimeout(() => {
console.log(`[DEBUG] Starting background Brotli compression...`);
startBrCompress();
}, 1000);
console.log(`[DEBUG] Compression scheduled for background`);
if (exists(dir("public"))) { if (exists(dir("public"))) {
await removeAsync(dir("public")); await removeAsync(dir("public"));