Handle commit stats timeouts gracefully

What does this MR do and why?

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/635511

Problem

Gitlab::Git::CommitStats#fetch_stats does not cache failures, so commits that exceed Gitaly's 30-second deadline pay the full timeout on every retry. A stats failure also turns a successfully loaded commit into an API 500, causing integrations to retry in a loop.

Solution

  • Behind the default-off commit_stats_failure_handling flag, remember project-repository timeouts for 10 minutes under a separate cache key.
  • When enabled, omit stats and log Gitlab::Git::CommandError failures in API::Entities::CommitDetail.

References

How to set up and validate locally

No manual setup is required.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading