perf: parallelize scout opportunity creation and remove sleep(2) #101

Open
opened 2026-03-20 12:36:16 +00:00 by cal · 0 comments
Owner

Problem

In open_st_pr_packs() (helpers/main.py ~line 1796-1803), after cards are displayed, scout opportunities are created one at a time with a 2-second asyncio.sleep() between each pack:

For 5 packs this adds ~8 seconds of intentional delay after the user already sees their cards.

Proposed Fix

  • Use asyncio.gather() to create all scout opportunities simultaneously
  • Remove or significantly reduce the asyncio.sleep(2) — investigate why it was added (rate limiting? race condition?) and address the root cause instead

Impact

Eliminates ~8 seconds of post-display delay for 5-pack opens. Lower priority since it happens after cards are shown, but still a noticeable UX drag.

## Problem In `open_st_pr_packs()` (`helpers/main.py` ~line 1796-1803), after cards are displayed, scout opportunities are created one at a time with a **2-second `asyncio.sleep()` between each pack**: For 5 packs this adds **~8 seconds of intentional delay** after the user already sees their cards. ## Proposed Fix - Use `asyncio.gather()` to create all scout opportunities simultaneously - Remove or significantly reduce the `asyncio.sleep(2)` — investigate why it was added (rate limiting? race condition?) and address the root cause instead ## Impact Eliminates ~8 seconds of post-display delay for 5-pack opens. Lower priority since it happens after cards are shown, but still a noticeable UX drag.
cal added the
ai-working
performance
labels 2026-03-20 12:36:25 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#101
No description provided.