Skip to content

perf: replace badge rate limiter timestamp arrays with sliding window…#1843

Closed
Kokila-chandrakar wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
Kokila-chandrakar:fix-badge-rate-limiter-sliding-window
Closed

perf: replace badge rate limiter timestamp arrays with sliding window…#1843
Kokila-chandrakar wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
Kokila-chandrakar:fix-badge-rate-limiter-sliding-window

Conversation

@Kokila-chandrakar
Copy link
Copy Markdown
Contributor

Summary

Optimized the existing Badge Rate Limiter by replacing timestamp array-based tracking with a sliding window counter approach to improve performance and memory efficiency.

Closes #1818


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Replaced timestamp array-based rate limiting logic with sliding window counter
  • Improved memory efficiency by removing per-request timestamp storage
  • Enhanced performance under high request load
  • Updated and validated test cases for new logic
  • Ensured backward-compatible rate limiting behavior

How to Test

Steps for the reviewer to verify this works:

  1. Run the application locally
  2. Trigger badge requests repeatedly within a short time window
  3. Verify rate limiting behaves correctly under load
  4. Run test suite:
    npm run test

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Kokila-chandrakar is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts) labels Jun 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder Priyanshu-byte-coder added level2 GSSoC Level 2 - Medium complexity (25 points) quality:exceptional GSSoC: Exceptional quality multiplier (×1.5) labels Jun 2, 2026
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Thanks! PR #1842 implements a more accurate true sliding window counter (using prev/curr window interpolation) for the same feature. Closing this in favor of that implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution level2 GSSoC Level 2 - Medium complexity (25 points) quality:exceptional GSSoC: Exceptional quality multiplier (×1.5) type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Optimize Badge Rate Limiter by Replacing Timestamp Arrays with a Sliding Window Counter

2 participants