Skip to content

fix(bot): Phase 2.2 LRU+TTL on duplicate-detection caches - #672

Merged
LucasSantana-Dev merged 2 commits into
mainfrom
fix/phase-2-2-dedup-cache-ttl
Apr 17, 2026
Merged

LucasSantana-Dev merged 2 commits into
mainfrom
fix/phase-2-2-dedup-cache-ttl

Conversation

@LucasSantana-Dev

Copy link
Copy Markdown
Owner

Summary

  • recentlyPlayedTracks: max 5000 entries, TTL 30 min
  • trackIdSet: max 5000 entries, TTL 30 min
  • lastPlayedTracks: max 5000 entries, TTL 30 min
  • artistGenreMap: max 2000 entries, TTL 24 hours

Problem

Duplicate-detection module's in-memory LRUCache fallbacks had undersized max entries (1000) and short TTL (1h for all). On long-running bot, caches could still accumulate excessive per-guild entries without proper eviction strategy.

Solution

Updated cache configuration based on actual usage patterns:

  • Playback history (3 caches): 5000 entries each, 30-minute TTL — tracks recent guild activity
  • Genre metadata (1 cache): 2000 entries, 24-hour TTL — genres rarely change within a day

All caches are keyed by <guildId>:<key>, so LRUCache evicts oldest-unused guild data automatically.

Tests

  • ✅ Typecheck: 0 errors
  • ✅ All tests: 2660 passed
  • ✅ No breaking changes (LRUCache API is Map-compatible)

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) April 17, 2026 00:47
@vercel

vercel Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Apr 17, 2026 0:50am

Request Review

@coderabbitai

coderabbitai Bot commented Apr 17, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LucasSantana-Dev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 2 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 2 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2092b141-904f-4bfb-957b-abbb28d19735

📥 Commits

Reviewing files that changed from the base of the PR and between 8e73c12 and 0cc31f1.

📒 Files selected for processing (1)
  • packages/bot/src/utils/music/duplicateDetection/types.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/phase-2-2-dedup-cache-ttl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit b095e20 into main Apr 17, 2026
12 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/phase-2-2-dedup-cache-ttl branch May 23, 2026 02:21

This branch was successfully deployed

1 active deployment
Preview — 0cc31f1a Deployed Apr 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant