Skip to content

perf: prune rate limiter clients in background#65

Open
kunal-9090 wants to merge 1 commit into
PranavAgarkar07:mainfrom
kunal-9090:codex/beamsync-55-background-prune
Open

perf: prune rate limiter clients in background#65
kunal-9090 wants to merge 1 commit into
PranavAgarkar07:mainfrom
kunal-9090:codex/beamsync-55-background-prune

Conversation

@kunal-9090

Copy link
Copy Markdown
Contributor

Summary

  • move expired rate-limit client pruning out of the request hot path
  • start a background ticker per limiter to prune stale entries every few minutes
  • keep allow() to O(1) lookup/update work unless max-client eviction is needed

Fixes #55

Validation

  • Not run locally: Go toolchain is not installed in this environment.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kunal-9090, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 43 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee565b8e-aa02-4645-ac7f-2dbe95d22e8e

📥 Commits

Reviewing files that changed from the base of the PR and between f0635c5 and 7134895.

📒 Files selected for processing (1)
  • beamsync/server.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@PranavAgarkar07

Copy link
Copy Markdown
Owner

@kunal-9090 This PR has merge conflicts with main that need to be resolved before it can be merged. Could you please merge main into your branch and fix the conflicts?

git fetch origin main
git checkout codex/beamsync-55-background-prune
git merge origin/main
# resolve conflicts in beamsync/server.go
git push

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.

🐛 [Bug] Rate limiter scans all clients under the mutex on every single request

2 participants