Skip to content

fix(cache): evict oldest entries first in SqliteCacheStore prune#5039

Merged
mcollina merged 1 commit into
nodejs:mainfrom
deepview-autofix:deepview/ee670a9216
Apr 17, 2026
Merged

fix(cache): evict oldest entries first in SqliteCacheStore prune#5039
mcollina merged 1 commit into
nodejs:mainfrom
deepview-autofix:deepview/ee670a9216

Conversation

@deepview-autofix
Copy link
Copy Markdown
Contributor

The #deleteOldValuesQuery used ORDER BY cachedAt DESC which deleted the most recently cached entries instead of the oldest ones, inverting the intended LRU-style eviction policy. Switch to ASC so that pruning removes the oldest entries as expected.

The `#deleteOldValuesQuery` used `ORDER BY cachedAt DESC` which deleted
the most recently cached entries instead of the oldest ones, inverting
the intended LRU-style eviction policy. Switch to `ASC` so that pruning
removes the oldest entries as expected.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: DeepView Autofix <276251120+deepview-autofix@users.noreply.github.com>
Co-Authored-By: Nikita Skovoroda <chalkerx@gmail.com>
Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com>
Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.03%. Comparing base (bc0a19c) to head (bd09c75).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5039      +/-   ##
==========================================
- Coverage   93.03%   93.03%   -0.01%     
==========================================
  Files         110      110              
  Lines       35793    35793              
==========================================
- Hits        33301    33300       -1     
- Misses       2492     2493       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina merged commit e0e61d3 into nodejs:main Apr 17, 2026
34 of 35 checks passed
mcollina pushed a commit that referenced this pull request Apr 29, 2026
The `#deleteOldValuesQuery` used `ORDER BY cachedAt DESC` which deleted
the most recently cached entries instead of the oldest ones, inverting
the intended LRU-style eviction policy. Switch to `ASC` so that pruning
removes the oldest entries as expected.

Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Nikita Skovoroda <chalkerx@gmail.com>
(cherry picked from commit e0e61d3)
@github-actions github-actions Bot mentioned this pull request May 1, 2026
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.

3 participants