Skip to content

docs(rate-limit): clarify KV-backed persistence vs in-memory fallback#6208

Merged
JhaSourav07 merged 2 commits into
JhaSourav07:mainfrom
vipul674:fix/rate-limiter-documentation
Jun 21, 2026
Merged

docs(rate-limit): clarify KV-backed persistence vs in-memory fallback#6208
JhaSourav07 merged 2 commits into
JhaSourav07:mainfrom
vipul674:fix/rate-limiter-documentation

Conversation

@vipul674

Copy link
Copy Markdown
Contributor

Related Issue

Closes #6207

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (changes to documentation only)
  • Refactor (code change that neither fixes a bug nor adds a feature)

Description

Improve documentation for and to clearly explain the dual-mode behavior:

  • With KV configured: Rate limit state is persisted across restarts and shared across all serverless instances via atomic INCR + EXPIRE operations using Upstash Redis/Vercel KV.
  • Without KV configured: Falls back to an in-memory TTL cache. State resets on cold start/server restart, but is effective at stopping aggressive single-instance spikes.

Changes

  • : Updated JSDoc to document the KV-backed persistence mode and fallback behavior, with link to Upstash setup docs.
  • : Added JSDoc documenting the in-memory limitation and recommending KV-backed alternatives for production.

Testing

  • Documentation-only change, no code behavior modified
  • Existing tests continue to pass

Checklist

  • My code follows the project's style guidelines
  • I have commented my code where necessary
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Improve documentation for RateLimiter and RefreshRateLimiter to clearly
explain the dual-mode behavior: KV-backed persistence when configured,
in-memory fallback when not. Add setup instructions reference for
Upstash Redis/Vercel KV.
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@vipul674 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3697.00 KB 3697.00 KB 0 B
Total CSS 296.58 KB 296.58 KB 0 B

@vipul674

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 Please Review.

@vipul674

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 I have submitted the fix. Please let me know if any changes are needed!

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great work clearly documenting the behavior of our rate limiters. I appreciate that you've explicitly outlined the dual-mode in lib/rate-limit.ts and noted the serverless lifecycle limitations of RefreshRateLimiter in services/github/refresh-rate-limiter.ts. The link to the Upstash docs is a nice touch for developers looking to configure persistence. This improves the developer experience significantly. Approved!

@Aamod-Dev Aamod-Dev added GSSoC 2026 mentor:Aamod007 level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. docs labels Jun 21, 2026
@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 21, 2026
@JhaSourav07 JhaSourav07 merged commit cf8351e into JhaSourav07:main Jun 21, 2026
10 of 11 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @vipul674! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

@github-actions github-actions Bot added the type:docs Documentation changes, wikis, or README updates label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs gssoc:approved PR has been reviewed and accepted for valid contribution points GSSoC 2026 level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:docs Documentation changes, wikis, or README updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Rate limiter uses in-memory Map that resets on server restart

3 participants