refactor: rename fetch_stats target and remove cache age gating

Rename the Makefile target from fetch_stats to fetch_github_stars to
match the script name. Remove CACHE_MAX_AGE_DAYS and the staleness
check so every run fetches all repos unconditionally.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen
2026-03-18 22:08:35 +08:00
parent b6d1bf9307
commit d65c6ccd64
2 changed files with 3 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ export
install: install:
uv sync uv sync
fetch_stats: fetch_github_stars:
uv run python website/fetch_github_stars.py uv run python website/fetch_github_stars.py
test: test:

View File

@@ -12,7 +12,6 @@ import httpx
from build import extract_github_repo, load_stars from build import extract_github_repo, load_stars
CACHE_MAX_AGE_DAYS = 7
DATA_DIR = Path(__file__).parent / "data" DATA_DIR = Path(__file__).parent / "data"
CACHE_FILE = DATA_DIR / "github_stars.json" CACHE_FILE = DATA_DIR / "github_stars.json"
README_PATH = Path(__file__).parent.parent / "README.md" README_PATH = Path(__file__).parent.parent / "README.md"
@@ -114,18 +113,8 @@ def main() -> None:
print(f"Pruned {len(cache) - len(pruned)} stale cache entries") print(f"Pruned {len(cache) - len(pruned)} stale cache entries")
cache = pruned cache = pruned
# Determine which repos need fetching (missing or stale) to_fetch = sorted(current_repos)
to_fetch = [] print(f"{len(to_fetch)} repos to fetch")
for repo in sorted(current_repos):
entry = cache.get(repo)
if entry and "fetched_at" in entry:
fetched = datetime.fromisoformat(entry["fetched_at"])
age_days = (now - fetched).days
if age_days < CACHE_MAX_AGE_DAYS:
continue
to_fetch.append(repo)
print(f"{len(to_fetch)} repos to fetch ({len(current_repos) - len(to_fetch)} cached)")
if not to_fetch: if not to_fetch:
save_cache(cache) save_cache(cache)