perf: parallelize roll_for_cards and bump pack limit to 20 #102

Merged
cal merged 1 commits from performance/97-parallelize-roll-for-cards into next-release 2026-03-20 15:34:10 +00:00

1 Commits

Author SHA1 Message Date
Cal Corum
56007aaeec perf: parallelize roll_for_cards DB calls and increase pack limit to 20 (#97)
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m54s
Restructure roll_for_cards into three phases: dice rolling (CPU-only),
batched player fetches (one per rarity tier via asyncio.gather), and
gathered writes (cards + pack patches concurrent). Reduces 20-30
sequential API calls to ~6 gathered calls for 5 packs.

Also fixes leaked `x` variable bug in dupe branch, removes dead
`all_players` accumulation, and bumps open-packs limit from 5 to 20.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:17:08 -05:00