Skip to content

fix: do not await cache.set during stale period#6

Merged
sanny-io merged 3 commits intodevfrom
fix/stale-awaiting
Feb 3, 2026
Merged

fix: do not await cache.set during stale period#6
sanny-io merged 3 commits intodevfrom
fix/stale-awaiting

Conversation

@sanny-io
Copy link
Member

@sanny-io sanny-io commented Feb 3, 2026

Summary by CodeRabbit

  • Documentation

    • Added "Caching Forever" section explaining how omitting ttl and swr stores cache results indefinitely, with examples and memory warnings.
  • Bug Fixes

    • Improved error handling around cache revalidation to reduce silent failures and improve reliability.
  • Chores

    • Package versions bumped to 1.0.2.

@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds README section "Caching Forever" explaining indefinite cache storage when neither ttl nor swr are set, with example and memory warning. Bumps package versions to 1.0.2 in root and packages. Refactors packages/cache/package.json keywords formatting. Adjusts stale-entry revalidation in packages/cache/src/plugin.ts to move error handling from an async try/catch to a .catch() on cache.set().

Changes

Cohort / File(s) Summary
Documentation
README.md
Adds "Caching Forever" section with example and warning about unbounded memory growth when neither ttl nor swr are provided.
Package metadata
package.json, packages/cache/package.json, packages/config/package.json
Version bumps from 1.0.1 → 1.0.2; packages/cache/package.json keywords array reformatted to multi-line. No functional API changes.
Cache plugin logic
packages/cache/src/plugin.ts
Stale-entry revalidation: replaced async-await try/catch wrapper with direct .then(...).catch(...) on cache.set(), moving error handling to the set promise chain while preserving overall behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing the await on cache.set during stale entry revalidation, which is the core modification in plugin.ts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/stale-awaiting

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.

@sanny-io sanny-io merged commit 042dd73 into dev Feb 3, 2026
1 of 2 checks passed
@sanny-io sanny-io deleted the fix/stale-awaiting branch February 3, 2026 05:01
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.

1 participant