feat: Phase 5 - Introduced Blizzard API calls throttling system#387
feat: Phase 5 - Introduced Blizzard API calls throttling system#387
Conversation
There was a problem hiding this comment.
Sorry @TeKrop, your pull request is larger than the review limit of 150000 diff characters
There was a problem hiding this comment.
Pull request overview
This PR implements Phase 5 of OverFast API's refactoring — it introduces an adaptive Blizzard API throttling system based on TCP Slow Start + AIMD and replaces the previous in-process AsyncioTaskQueue with a Valkey/taskiq-backed ValkeyTaskQueue. It also finalizes the Domain-Driven Design restructuring by consolidating enums, exceptions, parsers, and helpers into app/domain/ and app/infrastructure/.
Changes:
- Adaptive throttle: New
BlizzardThrottlesingleton (Valkey-backed) replaces the simple rate-limit flag, using TCP Slow Start + AIMD to self-regulate inter-request delay; 403 responses now return HTTP 503 instead of HTTP 429. - taskiq worker: Replaces
AsyncioTaskQueue+ cron-basedAsyncioTaskQueuewith a properValkeyListBroker/ValkeyTaskQueuebacked by taskiq, with scheduled cron tasks (check_new_hero,cleanup_stale_players) and on-demand refresh tasks. - DDD consolidation: Enums, parsers, helpers, and exceptions formerly scattered in feature modules are consolidated into
app/domain/andapp/infrastructure/, with all import paths updated.
Reviewed changes
Copilot reviewed 118 out of 133 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
app/adapters/blizzard/throttle.py |
Core TCP Slow Start + AIMD throttle implementation with Valkey-backed shared state |
app/adapters/blizzard/client.py |
Replaces rate-limit check with BlizzardThrottle, returns 503 on 403 |
app/adapters/tasks/valkey_task_queue.py |
New task queue adapter using SET NX for deduplication |
app/adapters/tasks/valkey_broker.py |
Custom taskiq broker backed by Valkey LPUSH/BRPOP |
app/adapters/tasks/worker.py |
taskiq worker with refresh and cron tasks |
app/domain/exceptions.py |
Adds RateLimitedError and consolidates SearchDataRetrievalError |
app/domain/enums.py |
Consolidates all domain enums from former feature modules |
app/domain/ports/throttle.py |
New ThrottlePort protocol |
app/config.py |
Adds throttle settings, removes old rate-limit settings |
app/monitoring/metrics.py |
Replaces AIMD metrics with throttle metrics |
app/main.py |
Thinned — logic moved to app/api/lifespan.py, app/api/exception_handlers.py, etc. |
tests/test_blizzard_throttle.py |
New comprehensive unit tests for BlizzardThrottle |
tests/test_valkey_task_queue.py |
New unit tests for ValkeyTaskQueue |
CONTRIBUTING.md / AGENTS.md / README.md |
Updated architecture documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
73af0ba to
b84b158
Compare
|



No description provided.