perf: parallelize scout opportunity creation and remove sleep(2) (#101) #156
@ -1786,14 +1786,18 @@ async def open_st_pr_packs(all_packs: list, team: dict, context):
|
||||
|
||||
pack_type_name = all_packs[0].get("pack_type", {}).get("name")
|
||||
if pack_type_name in SCOUTABLE_PACK_TYPES:
|
||||
for p_id in pack_ids:
|
||||
pack_cards = [c for c in all_cards if c.get("pack_id") == p_id]
|
||||
if pack_cards:
|
||||
await create_scout_opportunity(
|
||||
pack_cards, team, pack_channel, author, context
|
||||
await asyncio.gather(
|
||||
*[
|
||||
create_scout_opportunity(
|
||||
[c for c in all_cards if c.get("pack_id") == p_id],
|
||||
team,
|
||||
pack_channel,
|
||||
author,
|
||||
context,
|
||||
)
|
||||
if len(pack_ids) > 1:
|
||||
await asyncio.sleep(2)
|
||||
for p_id in pack_ids
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
async def get_choice_from_cards(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user