You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: run each Lighthouse report in its own process - #51
Lighthouse's trace engine keeps each report's trace in module-level state (FlowsHandler, RendererHandler, ...), so the server process grew with every report: 201 MB to 1,538 MB over 10 bbc.com reports in a local loop.
Each audit now runs in a short-lived bun src/audit.ts child that gets the URL, viewport, thresholds and formats on stdin and writes the report to stdout. All its memory goes back when it exits.
The 120s deadline is the spawn timeout; the child is killed when the context closes or the request ends.
Lighthouse already audits in its own tab over port 9222, so behaviour is unchanged.
Local run: server RSS 59 MB at start, 100 MB after 5 reports, 100 MB after 10.
The request abort signal closes the previously reported cancellation gap, and no remaining issue was found.
Each Lighthouse report runs in a short-lived bun src/audit.ts subprocess, with the request URL and audit options passed over stdin and the generated report returned over stdout. The route bounds the child with a 120-second timeout and terminates it when the browser context closes or the client request is aborted, then cleans up the browser and egress resources.
Latest changes: The newest change passes req.signal to Bun.spawn, so a client disconnect aborts the audit subprocess, and updates the comment to include request cancellation.
Walkthrough (2)
File
Change
src/audit.ts
Runs a Lighthouse audit as a separate process and writes the report to stdout.
src/routes/reports.ts
Spawns the audit subprocess, applies timeout and cancellation handling, and cleans up child and browser resources.
Fixed since the last review (1)
Abort the audit when the client disconnects · src/routes/reports.ts:117
Reviewed the commits since 5c92bcd
Tip
Comment @appwrite review to re-run, or mention @appwrite with a question.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lighthouse's trace engine keeps each report's trace in module-level state (
FlowsHandler,RendererHandler, ...), so the server process grew with every report: 201 MB to 1,538 MB over 10 bbc.com reports in a local loop.Each audit now runs in a short-lived
bun src/audit.tschild that gets the URL, viewport, thresholds and formats on stdin and writes the report to stdout. All its memory goes back when it exits.timeout; the child is killed when the context closes or the request ends.Local run: server RSS 59 MB at start, 100 MB after 5 reports, 100 MB after 10.