Improve videos

This commit is contained in:
Andras Schmelczer 2026-06-10 21:28:19 +01:00
parent 4012e4e047
commit d3418c67cc
11 changed files with 988 additions and 869 deletions

View file

@ -51,6 +51,31 @@ async function recordOne(storyboard: Storyboard): Promise<void> {
const u = r.url();
if (u.includes('ai-filters')) console.log(`[req] ${r.method()} ${u}`);
});
// Debug instrumentation: per-second request-rate histogram by path bucket.
// The desktop take intermittently freezes for ~30s after heavy filter
// churn; this shows whether a request flood is what's choking the page.
if (process.env.VIDEO_DEBUG_REQ_RATE === '1') {
const counts = new Map<string, number>();
page.on('request', (r) => {
let bucket: string;
try {
const u = new URL(r.url());
bucket = u.pathname.split('/').slice(0, 3).join('/');
} catch {
bucket = 'other';
}
counts.set(bucket, (counts.get(bucket) ?? 0) + 1);
});
const timer = setInterval(() => {
if (counts.size === 0) return;
const top = [...counts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 5);
console.log(
`[req-rate] ${top.map(([k, v]) => `${k}=${v}`).join(' ')}`
);
counts.clear();
}, 1000);
timer.unref();
}
await installDemoRoutes(page, storyboard);
const ctx = await prepareTimeline(page, storyboard);