Survive OpenDota proPlayers 429 during watchlist pro refresh.

Continue with watchlist names when /proPlayers is rate-limited, and soft-fail
the pro-matches step so daily can still refresh leaderboards and streamers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
voson
2026-07-30 23:10:32 +08:00
co-authored by Cursor
parent 76fa474b7d
commit c5a342cb5d
2 changed files with 16 additions and 7 deletions
+15 -7
View File
@@ -648,15 +648,10 @@ def main() -> None:
client = OpenDotaClient(consecutive_limit=int(args.streak_429))
_log("loading pro players ...")
pro_index = fetch_pro_index()
_log(f" {len(pro_index)} registered pros")
player_ids = parse_pro_filter(args.players, pro_index)
player_ids_raw = (args.players or "").strip()
watchlist: list[dict] | None = None
player_source = "cli"
if player_ids:
if player_ids_raw:
player_source = "cli"
elif not args.all_pros:
watchlist = load_watchlist(args.watchlist)
@@ -670,6 +665,19 @@ def main() -> None:
else:
player_source = "proPlayers"
_log("loading pro players ...")
try:
pro_index = fetch_pro_index()
except SystemExit as exc:
# Watchlist runs can proceed without /proPlayers when OpenDota is 429'd.
if args.all_pros and not player_ids_raw:
raise
_log(f" warn: {exc}; continuing with watchlist/cli names only")
pro_index = {}
_log(f" {len(pro_index)} registered pros")
player_ids = parse_pro_filter(args.players, pro_index)
picked = filter_pros(
pro_index,
with_team=args.with_team,
+1
View File
@@ -288,6 +288,7 @@ def run_daily(*, dry_run: bool = False) -> bool:
"--refresh-limit",
"15",
dry_run=dry_run,
soft_fail=True,
)
# Soft-fail Douyin enrichment (script itself exits 0; keep previous values on miss).
run_script("fetch_streamers.py", dry_run=dry_run, soft_fail=True)