Repository navigation
Replace process-wide limiter with shared api-core middleware - #84
Merged
Merged
Conversation
…dleware (#106) Delete the process-wide rate.NewLimiter(1, burst) - one busy caller could exhaust the budget for every caller, and N replicas made the real limit N times looser. Register api-core.go/ratelimit.Middleware (per-client/IP, Redis-backed, fail-closed 503) built from util.RedisPool. Bump api-core.go to v0.3.1. Dev overlay gains the RATE_LIMIT_* tier vars, REDIS_HOST/PORT for the namespace cache Service, and an api-cache ExternalSecret for REDIS_PASS.
paulyhedral
force-pushed
the
feature/fix-rate-limiting-per-client-ip
branch
from
September 9, 2026 16:24
34b1e66 to
509eadb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the platform-wide rate-limiting cut-over: sweetrpg/platform#106
(OpenSpec change
fix-rate-limiting-per-client-ip, tasks 2.4 + 5.1 + 5.2).Code
rate.NewLimiter(1, burst)- one busy caller couldexhaust the budget for every caller, and N replicas made the effective limit
N times looser than configured.
ratelimit.Middleware(redisPool, ratelimit.DefaultOptions())(per-client/IP, Redis-backed, fail-closed 503) built from
api-core.go/util.RedisPool().api-core.gov0.1.1 -> v0.3.1.Dev overlay / secrets
RATE_LIMIT_*tier vars (api-core defaults 120/60, 30/60).REDIS_HOST/REDIS_PORTfor the namespace cache Service.secrets/cache.yamlExternalSecret(api-cache, Akeyless/sweetrpg/admin/cache/auth->REDIS_PASS) + kustomization entry + basedeployment
envFrom.Verification
go build ./...,go vet ./...,go test ./...all pass.kustomize build kubernetes/overlays/devrenders the tier/Redis vars and theapi-cachesecret. Two concurrent client IPs now get independent budgets.