Skip to content
Open
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
33 changes: 18 additions & 15 deletions scripts/check-updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import tomllib
import urllib.request
import concurrent.futures
import urllib.error
from pathlib import Path

Expand Down Expand Up @@ -222,21 +223,23 @@ def main() -> None:
sys.exit(1)

updates = []
for formula_path in formula_files:
if formula_path.name == "simple.toml":
continue
result = check_formula(formula_path)
if result:
updates.append(result)

if apply_updates:
print(f" Applying update to {formula_path}...", file=sys.stderr)
update_formula_file(
formula_path,
result["new_version"],
result["new_url"],
result["new_sha256"],
)
formulas_to_check = [f for f in formula_files if f.name != "simple.toml"]

with concurrent.futures.ThreadPoolExecutor() as executor:
results = executor.map(check_formula, formulas_to_check)

Comment on lines +228 to +230

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ThreadPoolExecutor() is created without an explicit max_workers, so the concurrency level will vary by machine (defaults to min(32, os.cpu_count()+4)). As the number of formulas grows this can create a large burst of concurrent GitHub API requests + tarball downloads/hashing, increasing the chance of rate-limiting or flaky timeouts in the scheduled workflow. Consider setting a reasonable upper bound (and optionally making it configurable via CLI flag/env var) based on I/O-bound workload expectations.

Copilot uses AI. Check for mistakes.
for formula_path, result in zip(formulas_to_check, results):
if result:
updates.append(result)

if apply_updates:
print(f" Applying update to {formula_path}...", file=sys.stderr)
update_formula_file(
formula_path,
result["new_version"],
result["new_url"],
result["new_sha256"],
)

print(json.dumps(updates, indent=2))

Expand Down
Loading