Skip to content

lib/ratelimit, lib/concurrentlimit: add protocol-neutral rate and concurrency limiters - #288

Open
Vikramarjuna wants to merge 2 commits into
Cloud-Foundations:masterfrom
Vikramarjuna:rate-limiters
Open

lib/ratelimit, lib/concurrentlimit: add protocol-neutral rate and concurrency limiters#288
Vikramarjuna wants to merge 2 commits into
Cloud-Foundations:masterfrom
Vikramarjuna:rate-limiters

Conversation

@Vikramarjuna

@Vikramarjuna Vikramarjuna commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Adds lib/ratelimit, a three-tier token-bucket rate limiter (global, per-method, per-user-per-method) intended to be shared across SRPC, gRPC and REST handlers so quotas cannot be bypassed by switching protocols. Denials return *errors.ResourceExhaustedError.

Refactors the existing lib/srpc/serverutil.PerUserMethodLimiter, lifting its per-(user, method) semaphore into a protocol-neutral lib/concurrentlimit package so future gRPC and REST adapters can reuse it. Semantics unchanged; the SRPC adapter becomes a thin wrapper preserving NewPerUserMethodLimiter and BlockMethod signatures, so existing callers build unmodified.

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