Skip to content

fix(user-metrics): paginate response to prevent OOM - #431

Open
karpikpl wants to merge 2 commits into
mainfrom
copilot/fix-issue-416
Open

fix(user-metrics): paginate response to prevent OOM#431
karpikpl wants to merge 2 commits into
mainfrom
copilot/fix-issue-416

Conversation

@karpikpl

Copy link
Copy Markdown
Collaborator

Fixes #416

Summary

  • Adds bounded pagination to /api/user-metrics (page, pageSize/per_page/limit) with a default and hard max of 500 rows.
  • Pages historical DB reads by distinct user before aggregating per-day rows, avoiding full enterprise user-list materialization for the default dashboard call.
  • Preserves the existing array response shape for UI callers and adds pagination metadata headers.

Validation

  • npm test
  • npm run build
  • npm run lint -- --max-warnings=0 attempted; blocked by existing dependency resolution error: brace-expansion does not provide export expand.
  • Diff scanned for obvious secrets (none found).

karpikpl added 2 commits July 13, 2026 21:43
…ses (#416)

Add bounded pagination for /api/user-metrics with a default and maximum page size of 500 rows. Historical DB reads now page distinct users before aggregating per-day records, while preserving array responses for existing callers and exposing pagination metadata headers.

Validation: npm test; npm run build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbf27d66-9aca-451b-85ee-3a32e0775d52
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbf27d66-9aca-451b-85ee-3a32e0775d52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/api/user-metrics loads the full user list into memory per request → JS heap OOM crash on large enterprises

1 participant