You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PR_DESCRIPTION.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,45 @@
1
1
## Summary
2
+
3
+
Implements **distributed rate limiting** for the tiered API limiter using **Redis** when `REDIS_URL` is configured. This removes the bypass where limits lived only in process memory (restart or horizontal scaling cleared or split enforcement).
4
+
5
+
## Purpose / Motivation
6
+
7
+
Issue [#116](https://github.com/nathydre21/wata-board/issues/116): in-memory rate limiting could be bypassed by restarting the server or routing traffic across multiple instances. Production deployments need a shared store so limits are consistent and durable across replicas.
- Set **`REDIS_URL`** in environments where multiple app instances run or restarts must not reset limits (same variable as existing Redis pub/sub for WebSockets).
22
+
- Keys use the prefix `rl:tier:requests:` and `rl:tier:queue:` per user id derived from `x-user-id` or IP.
23
+
24
+
## How to Test
25
+
26
+
1.**With Redis**: Point `REDIS_URL` at a Redis instance, start the API, and hit `/api/payment` (or any route behind `tieredRateLimiter`) until `429` / queued responses; repeat from another client or after restart — counts should **continue** from shared state, not reset per process.
27
+
2.**Without Redis**: Unset `REDIS_URL` — behavior should match prior in-memory limiting for a single process.
28
+
3.**Monitoring**: `GET /api/monitoring/rate-limit-status` with `x-user-id` should return tier + limit fields without throwing.
29
+
30
+
## Breaking Changes
31
+
32
+
None intended. Response shapes and HTTP status codes for rate limit / queue paths are unchanged; Redis is additive behind configuration.
33
+
34
+
## Related Issues
35
+
36
+
Closes nathydre21/wata-board#116
37
+
38
+
## Checklist
39
+
40
+
-[x] Implementation scoped to tiered limiter + monitoring route
41
+
-[ ] CI / full backend build (repo may have pre-existing TS issues outside this change)
42
+
-[ ] Redis connectivity verified in staging
2
43
This PR resolves three related reliability issues in one delivery:
0 commit comments