Skip to content

feat: Phase 5 - Introduced Blizzard API calls throttling system#387

Merged
TeKrop merged 34 commits intomainfrom
feature/phase-5-blizzard-throttle
Mar 9, 2026
Merged

feat: Phase 5 - Introduced Blizzard API calls throttling system#387
TeKrop merged 34 commits intomainfrom
feature/phase-5-blizzard-throttle

Conversation

@TeKrop
Copy link
Owner

@TeKrop TeKrop commented Mar 4, 2026

No description provided.

@TeKrop TeKrop requested a review from Copilot March 4, 2026 19:39
@TeKrop TeKrop self-assigned this Mar 4, 2026
@TeKrop TeKrop added the enhancement New feature or request label Mar 4, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @TeKrop, your pull request is larger than the review limit of 150000 diff characters

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BlizzardThrottle singleton (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-based AsyncioTaskQueue with a proper ValkeyListBroker/ValkeyTaskQueue backed 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/ and app/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.

TeKrop and others added 4 commits March 8, 2026 11:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@TeKrop TeKrop force-pushed the feature/phase-5-blizzard-throttle branch from 73af0ba to b84b158 Compare March 8, 2026 13:14
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@TeKrop TeKrop merged commit 22a31f7 into main Mar 9, 2026
5 checks passed
@TeKrop TeKrop deleted the feature/phase-5-blizzard-throttle branch March 9, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants