perf: redundant GET after create/update in custom_commands_service #95
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#95
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
Several methods in
services/custom_commands_service.pymake an extra GET request after a POST/PUT, even though the API response already contains the created/updated object.Locations
create_command()line 123: GET after POSTupdate_command()line 220: GET after PUTget_or_create_creator()line 539: GET after PUT (3 total round-trips: GET + PUT + GET)help_commands_service:create_help()line 104,update_help()line 207 — same patternAlso in
services/draft_list_service.pylines 181–188add_to_list()does GET + POST + verification GET (3 round-trips). Other mutation methods (remove_player_from_list,move_entry_up, etc.) skip the verification.Also in
services/custom_commands_service.pylines 611–648 (get_statistics)9 sequential independent API calls for the stats dashboard. All are independent and could be gathered.
Fix
Return the API response directly from POST/PUT instead of making a second GET:
For
get_statistics, useasyncio.gather()for all 9 calls.Impact
LOW-MEDIUM — Custom commands aren't the highest-frequency path, but each redundant call adds 50–100ms.
PR #112 opened: #112
Approach: Eliminated redundant GET requests after POST/PUT in
custom_commands_serviceandhelp_commands_serviceby returning API responses directly. Addedasyncio.gather()to parallelize all 9 sequential calls inget_statistics().Note:
draft_list_service.add_to_list()verification GET was left in place —DraftListrequires full nestedTeam/Playerobjects that aren't in the POST payload (only IDs). The N+1 loops in the cleanup methods are tracked in #89.