Skip to content

Retention prune walks capture folders synchronously before the transport connects #294

Closed

Description

@TMHSDigital

Summary

When SCREENCAST_RETENTION_DAYS is set, a recursive readdirSync/statSync over screenshots/ and frames/ runs before server.connect.

Where

  • src/index.ts:48-57
  • src/utils/retention.ts:36-70

Details

sample_frames can write up to 1000 PNGs per call into frames/, so these folders can hold tens of thousands of files.

Impact

Startup is delayed by seconds and a client's initialize can time out.

Suggested fix

Connect first, then run the prune in the background with fs.promises.

Acceptance criteria

  • Transport connects before pruning
  • Prune runs async and logs failures

Getting started

  • Relevant files: src/index.ts, src/utils/retention.ts
  • How to run tests: npm run build && npm test (also npm run typecheck and npm run lint)
  • Related docs: CONTRIBUTING.md, AGENTS.md

Filed by repo-audit/full-audit at f2fda28. Severity: low. Effort: S. audit-key: performance|src/utils/retention.ts|pruneCaptures

Activity

  1. added
    good first issue
    priority: low
    performance
    on Nov 9, 2026
  2. TMHSDigital commented on Nov 10, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in d4225d7: pruneCaptures is now async (fs/promises) and runs in the background after server.connect; a failure is logged to stderr. Verified with the retention tests (now awaiting the async prune) plus build/typecheck/lint.

  3. added a commit that references this issue on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueperformancepriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions