Skip to content

fix: cap analytics in-memory cache at 1000 entries to prevent OOM#737

Merged
OlaGreat merged 1 commit into
OlaGreat:mainfrom
olywales-stack:fix/674-analytics-cache-max-size
Jun 30, 2026
Merged

fix: cap analytics in-memory cache at 1000 entries to prevent OOM#737
OlaGreat merged 1 commit into
OlaGreat:mainfrom
olywales-stack:fix/674-analytics-cache-max-size

Conversation

@olywales-stack

Copy link
Copy Markdown
Contributor

The analytics in-memory cache was unbounded — every unique (profileId, startDate, endDate) combo inserted a permanent entry, risking OOM under load or targeted abuse.

  • backend/src/analytics.ts — added CACHE_MAX_SIZE = 1000 constant. After each set(), if the cache exceeds the limit the oldest inserted entry (first key in Map insertion order) is evicted, keeping memory use bounded.

Closes #674

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@olywales-stack Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@OlaGreat OlaGreat merged commit 75af033 into OlaGreat:main Jun 30, 2026
1 check failed
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.

[Backend] Analytics in-memory cache has no max-size limit — OOM risk

2 participants