Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions features/tourney/tourney_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from discord import app_commands
from discord.ext import commands, tasks
import asyncio
import functools
import re
import datetime
from .matcherino import (
Expand Down Expand Up @@ -735,7 +736,10 @@ async def match_refresher_task(self):
if match_num is None:
if not topic_team_name:
continue
lookup = find_match_by_team_name(bracket_url, topic_team_name)
loop = asyncio.get_event_loop()
lookup = await loop.run_in_executor(
None, find_match_by_team_name, bracket_url, topic_team_name
)
if lookup.get("status") != "found":
continue
match_num = lookup["match_number"]
Expand All @@ -751,17 +755,32 @@ async def match_refresher_task(self):
pass

# 4. Fetch Fresh Match Data (with topic team for fuzzy mismatch check)
data = fetch_ticket_context(
bracket_url, match_num, topic_team_name=topic_team_name
loop = asyncio.get_event_loop()
data = await loop.run_in_executor(
None,
functools.partial(
fetch_ticket_context,
bracket_url,
match_num,
topic_team_name=topic_team_name,
),
)
if data.get("status") != "success":
# Match number not in bracket — try team name fallback
if topic_team_name:
lookup = find_match_by_team_name(bracket_url, topic_team_name)
lookup = await loop.run_in_executor(
None, find_match_by_team_name, bracket_url, topic_team_name
)
if lookup.get("status") == "found":
match_num = lookup["match_number"]
data = fetch_ticket_context(
bracket_url, match_num, topic_team_name=topic_team_name
data = await loop.run_in_executor(
None,
functools.partial(
fetch_ticket_context,
bracket_url,
match_num,
topic_team_name=topic_team_name,
),
)
if data.get("status") == "success":
# Persist corrected match number in topic
Expand Down
Loading