krz/hutch-stats

Server-side utility for calculating contributions for sourcehut users.

clone: git clone https://gitbay.org/krz/hutch-stats.git

259d02a4639b46a436bbc6a9ba204834cdb67633

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2026-04-12T01:11:08Z

fix: wrap repo fetching in exception handling
 src/srht_contrib/services/git.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/srht_contrib/services/git.py b/src/srht_contrib/services/git.py
index bf7493b..9bd9848 100644
--- a/src/srht_contrib/services/git.py
+++ b/src/srht_contrib/services/git.py
@@ -8,7 +8,7 @@ from typing import Any
 
 from srht_contrib.config import Settings
 from srht_contrib.schemas import NormalizedEvent
-from srht_contrib.services.srht_client import SourceHutGraphQLClient
+from srht_contrib.services.srht_client import SourceHutClientError, SourceHutGraphQLClient
 from srht_contrib.services.types import BackfillBatchResult
 from srht_contrib.utils.dates import ensure_utc, parse_datetime
 from srht_contrib.utils.identity import ActorIdentityResolver
@@ -97,7 +97,11 @@ class GitIngestionService:
         events: list[NormalizedEvent] = []
         for repository in discovered_repositories:
             owner, repo_name = self._split_repository(actor, repository)
-            repo_events = self._fetch_repository_commits(actor=actor, owner=owner, repo_name=repo_name, since=since_dt)
+            try:
+                repo_events = self._fetch_repository_commits(actor=actor, owner=owner, repo_name=repo_name, since=since_dt)
+            except SourceHutClientError:
+                logger.warning("git poll skipped repository=%s/%s due to GraphQL error", owner, repo_name, exc_info=True)
+                continue
             events.extend(repo_events)
 
         logger.info("git poll complete for actor=%s normalized_events=%s", actor, len(events))