More fixes

This commit is contained in:
Andras Schmelczer 2026-03-18 22:46:08 +00:00
parent 15fa09430b
commit 6b12e21d50
54 changed files with 1665 additions and 630 deletions

View file

@ -5,7 +5,7 @@ import { NetworkCache } from './network-cache.js';
const VIEWPORT = { width: 1200, height: 630 };
const NAVIGATION_TIMEOUT = 15_000;
const READY_TIMEOUT = 15_000;
const RENDER_BUFFER_MS = 200;
const RENDER_BUFFER_MS = 500;
const POOL_SIZE = 3;
let browser: Browser | null = null;
@ -262,9 +262,10 @@ export async function takeScreenshot(url: string, authHeader?: string): Promise<
const t2 = performance.now();
console.log(` Ready: ${(t2 - t1).toFixed(0)}ms`);
// Brief buffer for SwiftShader to finish rendering the WebGL frame.
// Reduced from 500ms → 200ms since tiles now load from the in-memory
// cache and don't need network round-trips.
// Buffer for SwiftShader to finish rendering the WebGL frame after
// __screenshot_ready fires. The frontend uses double-rAF before signaling,
// so one paint cycle has already completed — this is extra safety for
// compositor staging and any residual tile/layer rendering.
await page.waitForTimeout(RENDER_BUFFER_MS);
// JPEG at quality 85: ~3-5x faster encoding than PNG with negligible