Skip to content

chore: remove the dead DRF throttle config that misled a diagnosis - #143

Merged
saqibmanan merged 1 commit into
devfrom
fix/remove-dead-throttle-config
Sep 3, 2026
Merged

chore: remove the dead DRF throttle config that misled a diagnosis#143
saqibmanan merged 1 commit into
devfrom
fix/remove-dead-throttle-config

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

No behaviour change — the setting was doing nothing.

"DEFAULT_THROTTLE_RATES": {"anon": "100/hour", "user": "1000/hour"},

This had no effect whatsoever:

  • DEFAULT_THROTTLE_CLASSES was never configured
  • no view declares throttle_classes
  • /api/graphql, the endpoint that actually gets hammered, is a Strawberry view rather than a DRF one

Why remove it rather than leave it

It was not merely inert. While diagnosing a flood of 429s on 2026-09-03 it was the first thing found, read as the cause, and very nearly "fixed" — a change that would have altered nothing while sending the investigation off in the wrong direction. Config that looks like it governs behaviour but does not is worse than no config.

Replaced with a comment pointing at what actually runs: api/middleware/rate_limit.py (registered in MIDDLEWARE), 5000/hour for GET and 1000/hour for other methods, keyed on the client IP from X-Forwarded-For.

Note on the limits themselves

Left unchanged deliberately. 1000/hour for non-GET is reasonable; the incident was caused by a frontend loop issuing 6,230 requests per minute (DataSpaceFrontend#453), not by the limit being too low. Raising it would only have let a runaway client do more damage.

Worth a separate look: the limit is keyed per IP, so everyone behind a NAT gateway shares one budget — which is why a single broken client took out every other user at that address.

DEFAULT_THROTTLE_RATES was set to {"anon": "100/hour", "user":
"1000/hour"} and had no effect whatsoever: DEFAULT_THROTTLE_CLASSES was
never configured, no view declares throttle_classes, and the endpoint
that actually gets hammered (/api/graphql) is a Strawberry view, not a
DRF one.

It was not merely inert. While diagnosing a flood of 429s on 2026-09-03
it was the first thing found, read as the cause, and very nearly
"fixed" - a change that would have altered nothing while sending the
investigation the wrong way.

Replaced with a comment pointing at api/middleware/rate_limit.py, which
is what actually runs: 5000/hour for GET, 1000/hour for other methods,
keyed on the client IP from X-Forwarded-For.

No behaviour change - the setting was doing nothing.
@saqibmanan
saqibmanan merged commit 4399ed9 into dev Sep 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant