perf: parallelize independent API calls (team lookups, injury cmds, trade validation) #90
Labels
No Label
ai-changes-requested
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
in-next-release
status/in-progress
status/pr-open
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-v2#90
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Many commands make 2–4 independent API calls sequentially when they could use
asyncio.gather().Team lookups (away + home)
commands/gameplay/scorebug.pylines 77–81, 184–187commands/league/submit_scorecard.pylines 110–115tasks/live_scorebug_tracker.pylines 120–126 (inside a per-scorecard loop — compounds)Pattern:
Injury commands
commands/injuries/management.py:injury_rolllines 117–125:get_current_state()+search_players()independentinjury_set_newlines 533–548: multiple independent service callsinjury_clearlines 720–741: same patternTrade validation
services/trade_builder.pylines 526–536: per-participant roster validation is sequential but independent per teamFix
Replace sequential awaits with
asyncio.gather()in each case. Example:Impact
MEDIUM — Each location saves 50–200ms. Scorebug tracker compounds across 5+ games per update cycle.
PR #106 opened: #106
Replaced all sequential awaits with
asyncio.gather()across 5 files:asyncio.sleep(0)as a None-returning coroutine for optional IDs)get_current_state()+search_players()in all 3 injury commandsAlso fixed missing
awaitonscorecard_trackerasync methods inscorebug.pyandlive_scorebug_tracker.py(auto-corrected by linter — those methods were made async in a prior working-tree change).