DOC-6349 rate limiter use case example#2866
Conversation
Agent-Id: agent-cddcf4ec-6649-4b67-84bd-17635e37ad44 Linked-Note-Id: 5fd64c6b-5eb4-4a9d-b3aa-b64870ac9c7d
Agent-Id: agent-4d50ac2e-82bf-4861-b9fb-75c492b32473 Linked-Note-Id: b761f098-e650-4125-8fdf-c79a2828de99
Agent-Id: agent-cba54d2b-2475-4fbd-9160-491b7700deb7 Linked-Note-Id: 819ebe93-abc0-40ef-8058-8b3d82247fc9
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
| capacity=capacity, | ||
| refill_rate=refill_rate, | ||
| refill_interval=refill_interval | ||
| ) |
There was a problem hiding this comment.
Config update limiter assignment lost between requests
Medium Severity
In _handle_config_update, self.limiter = TokenBucket(...) creates an instance attribute on the current handler, but BaseHTTPRequestHandler creates a new instance for each request. The instance is discarded after the response, so the updated limiter is never used by subsequent requests — they still read the old class-level limiter. Meanwhile, self.config[...] = ... mutations persist because they modify the shared class-level dict in place. This causes a silent mismatch: the displayed config updates but the actual rate limiting behavior doesn't change. It needs to assign to RateLimiterHandler.limiter (the class variable) instead.
dwdougherty
left a comment
There was a problem hiding this comment.
Just one nitpick. Otherwise, language LGTM. I didn't review code.
I'll give the other things you mentioned some thought, but I don't see why you can't just go ahead and merge this as is (assuming @mich-elle-luna approves as well).
Co-authored-by: David Dougherty <david.dougherty@redis.com>
|
@dwdougherty Thanks for spotting that (again!) This is the first time I've done a task with Augment Intent - there might be a way to pass it a link to the style guide as a general preference. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.


WIP
A simple and partially-implemented use case example for a Redis rate limiter. The code works but the presentation, etc, probably needs some work yet. When we've got a plan together, I'll continue and add the corresponding examples for the other clients.
Some things to think about:
local_examplesbut maybe get added to the page in a scrollable foldout or something?All other feedback and suggestions welcome, of course :-)
Note
Low Risk
Low risk documentation-only addition; the only functional code is standalone Python demo/reference that doesn’t affect production runtime behavior.
Overview
Introduces a new
develop/use-casesdocs section and adds an initial Rate limiting use case page describing a Redis/Lua token-bucket algorithm and how to integrate it.Adds standalone Python reference code: a
TokenBuckethelper that executes the Lua script viaEVALSHA/EVALand a small HTTP demo server that lets readers interactively test requests and change limiter settings.Written by Cursor Bugbot for commit 617a80f. This will update automatically on new commits. Configure here.