Repository navigation
Conversation
|
@UltimateUser1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
12 tasks
Hel-Phone#752) The general limiter kept per-process Maps, so with N Render replicas an IP could send N times the configured limit. When REDIS_URL is set, the counter now lives in Redis (atomic INCR + PEXPIRE via Lua). Without it, the in-memory path is unchanged for local dev and tests. Redis errors fail open and are logged, so emergency traffic keeps flowing during an outage.
UltimateUser1
force-pushed
the
fix/issue-752-shared-redis-rate-limiter
branch
from
October 18, 2026 18:39
94a500b to
4959dc1
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.
Summary
The general API rate limiter kept its request counters in per-process
Maps. On Render with multiple replicas, each instance enforced the limit independently, so one IP could send up to N times the configured budget (N = replica count), and per-replica 429s looked like client flakiness.This PR moves the counter into Redis when
REDIS_URLis set, so every replica shares one budget.Changes
server/index.js:createRateLimiteruses an atomic Redis fixed-window counter (INCR+PEXPIREin a single Lua script, so the TTL is always set) when Redis is configured.REDIS_URL, the existing in-memory path is unchanged, so local dev and tests behave as before.keyPrefixoption keeps counters for different limiters separate.Failure semantics
[rate-limit] Redis unavailable, failing open. Blocking emergency traffic during a Redis outage is the riskier choice, and the log line is the alerting hook.Testing
Not run in this PR. Suggested check: start 3 instances against one Redis with
RATE_LIMIT_MAX=100, send 300 requests from one IP across them, and expect about 200 responses with 429.Closes #747
Closes #752
Closes #756
Closes #757