Skip to content

Add rate limiting to MMR API endpoints#86

Merged
raimannma merged 1 commit intomasterfrom
claude/reduce-mmr-rate-limits-2q39h
Feb 7, 2026
Merged

Add rate limiting to MMR API endpoints#86
raimannma merged 1 commit intomasterfrom
claude/reduce-mmr-rate-limits-2q39h

Conversation

@raimannma
Copy link
Member

Description

Implements rate limiting across all MMR-related API endpoints to protect against abuse and ensure fair resource usage. This change adds rate limit checks to 6 endpoints in the MMR module using a configurable quota system with IP-based, key-based, and global limits.

The rate limits are applied consistently across all endpoints:

  • IP limit: 10 requests per 10 seconds
  • Key limit: 10 requests per 10 seconds
  • Global limit: 20 requests per 10 seconds

Additionally, the API documentation has been updated to reflect the new rate limit values (previously listed as 100req/s with no key/global limits).

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)
  • Other (please describe):

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

The rate limiting is applied at the handler level for the following endpoints:

  • GET /v1/players/mmr (batch MMR)
  • GET /v1/players/mmr/hero (batch hero MMR)
  • GET /v1/players/mmr/distribution (MMR distribution)
  • GET /v1/players/mmr/distribution/hero/{hero_id} (hero MMR distribution)
  • GET /v1/players/mmr/{account_id} (MMR history)
  • GET /v1/players/mmr/{account_id}/hero/{hero_id} (hero MMR history)

https://claude.ai/code/session_01QYY6jEz4bRkMr9s7xsM1p7

… 20req/10s global)

MMR endpoints had rate limits documented in OpenAPI but not enforced in code.
Added apply_limits() calls with shared "mmr" bucket across all 6 endpoints.

https://claude.ai/code/session_01QYY6jEz4bRkMr9s7xsM1p7
@raimannma raimannma merged commit eb448a4 into master Feb 7, 2026
10 checks passed
@raimannma raimannma deleted the claude/reduce-mmr-rate-limits-2q39h branch February 7, 2026 07:23
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.

2 participants