feat(api): share rate-limit counters across replicas via Redis (ADR-0001)#207
Merged
Conversation
…001) Fiber''s limiter middleware kept counters in process memory, so N replicas would give every IP N times the configured budget. Back both limiters (general + OAuth) with a fiber.Storage adapter over the existing Redis client under a ratelimit: key prefix. Fails open on Redis errors — Get reports "no entry", Set/Delete swallow with a rate-limited log — because abuse protection erroring into a full API outage when Redis blips would be strictly worse. Implements action item 2 of docs/adr/0001-sse-multi-replica.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
3 tasks
doughknee
added a commit
that referenced
this pull request
Jun 10, 2026
…uts (#208) Implements action items 3 and 5 of docs/adr/0001-sse-multi-replica.md. Prereqs landed first: sse:ctl:resubscribe control channel (#206) and Redis-backed rate-limit counters (#207). With those in, no remaining core-api state assumes a single pod. - replicas: 2 with maxUnavailable: 0 / maxSurge: 1 so deploys never drop below capacity; SSE clients ride through on their 3s retry - PodDisruptionBudget (minAvailable: 1) so node drains and cluster upgrades cannot take the whole API down - cdc-runbook diagram now shows the per-replica Redis pub/sub fan-out and the resubscribe control channel Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Action item 2 of ADR-0001.
replicas: Ngives every IP N× the configured budget (120/min general, 10/5min OAuth)fiber.Storageadapter over the existing Redis client (ratelimit:key prefix; the two limiters' key spaces stay disjoint via their KeyGenerators)Getreports "no entry",Set/Deleteswallow with a rate-limited log. Abuse protection turning a Redis blip into a full API outage would be strictly worse than briefly unmetered trafficTest plan
go vet+ full unit suite pass locallyratelimit:*keys appear in Redis🤖 Generated with Claude Code