-
Notifications
You must be signed in to change notification settings - Fork 623
fix: revalidate usage on get #5116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🤖 My Senior Dev — Analysis Complete👤 For @kaposke📁 Expert in View your contributor analytics → 📊 2 files reviewed • 4 need attention
🚀 Open Interactive Review →The full interface unlocks features not available in GitHub:
💬 Chat here: 📖 View all 12 personas & slash commandsYou can interact with me by mentioning In PR comments or on any line of code:
Slash commands:
AI Personas (mention to get their perspective):
For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews. |
TBonnin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add/modify tests to check the new behavior
5d3a9b7 to
dc661e9
Compare
| if (entry.isErr()) { | ||
| return Err(entry.error); | ||
| } | ||
| if (entry.value === null || entry.value.revalidateAfter < now.getTime()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can value be null?
Ensure
UsageTrackerrevalidates stale or missing cache entries on readsUpdates
UsageTrackerso that bothgetandgetAllinitiaterevalidatewhen cache entries are missing or have exceededrevalidateAfter, keeping read paths consistent with the existingincrbehavior. Adds integration tests covering null, stale, and fresh cache scenarios forget/getAll, using spies to assert revalidation triggers and fake timers to simulate staleness windows.Key Changes
• Invoke
revalidatefromUsageTracker.getwhenentry.valueisnullor stale• Invoke
revalidateper metric insideUsageTracker.getAllunder the same conditions• Extend
packages/account-usage/lib/usage.integration.test.tswith coverage forgetandgetAllrevalidation behaviors usingvitimers and spiesAffected Areas
•
packages/account-usage/lib/usage.ts•
packages/account-usage/lib/usage.integration.test.tsThis summary was automatically generated by @propel-code-bot