fix(fetcher): back off on GitHub secondary limits in refresh cron

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shay
2026-12-01 11:43:40 -05:00
co-authored by Claude Opus 5.5
parent 0835c64a63
commit 1d32dee489
5 changed files with 89 additions and 5 deletions
+13
View File
@@ -277,3 +277,16 @@ def test_repo_languages_capped_to_recent_owned_repos(monkeypatch):
assert sorted(src.calls) == ["alice/mid", "alice/new"]
assert repos[1]["language_bytes"] == {"Python": 1}
assert "language_bytes" not in repos[0]
@responses.activate
def test_rate_limit_error_carries_retry_after():
responses.add(
responses.GET, "https://api.github.com/users/alice",
json={"message": "You have exceeded a secondary rate limit."}, status=403,
headers={"Retry-After": "42"},
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError) as exc:
src.fetch_user_data("alice")
assert exc.value.retry_after == 42